Created
May 16, 2025 23:43
-
-
Save loorlab/e008cc7c591889304a27238a42840649 to your computer and use it in GitHub Desktop.
Display in console the custom fields used by the CPT person - WP CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp eval ' | |
$posts = get_posts([ | |
"post_type" => "person", | |
"posts_per_page" => 500, | |
"fields" => "ids" | |
]); | |
$keys = []; | |
foreach ($posts as $id) { | |
foreach (array_keys(get_post_meta($id)) as $meta_key) { | |
$keys[$meta_key] = true; | |
} | |
} | |
echo "Campos personalizados encontrados en el CPT person:\n"; | |
foreach (array_keys($keys) as $key) { | |
echo "- $key\n"; | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment