Timeline for Get all meta keys assigned to a post type
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 17, 2016 at 10:55 | comment | added | yolo191919 | I think I'll have to temporarily create a post, of the required post type, and then read the meta keys that are created in the DB, and then I can delete that temporary post. | |
Dec 16, 2016 at 19:11 | comment | added | Milo | There's no way to reliably get all possible keys, they might be dynamically named based on data that doesn't yet exist. You can get all existing keys for existing posts, but I wouldn't suggest querying for all posts- you'll eventually run out of memory if you add lots of posts. | |
Dec 16, 2016 at 19:05 | comment | added | yolo191919 |
Nope I'm wrong, can't because global $wp_meta_boxes is only accessible from certain places :(
|
|
Dec 16, 2016 at 18:52 | comment | added | yolo191919 |
I think I've figured it out... by getting all registered meta_box es. I'll post back if that's it
|
|
Dec 16, 2016 at 18:51 | comment | added | yolo191919 |
get_post_meta() is for getting the meta value knowing the meta _key . I want to get all meta_key s assigned to a post type , without knowing anything but the post type
|
|
Dec 16, 2016 at 18:45 | comment | added | Gareth Gillman | I don't think you can get post meta fields without a post id - developer.wordpress.org/reference/functions/get_post_meta The ID is a required field, so if you believe there are fields set outside of the posts then you would need to find another function to grab that data. | |
Dec 16, 2016 at 18:42 | comment | added | yolo191919 | I need be able to get all custom fields' information even if there aren't any existing posts of the post type | |
Dec 16, 2016 at 18:39 | history | answered | Gareth Gillman | CC BY-SA 3.0 |