As mentioned in the comments you can query the postmeta table directly:
public function get_metadata_keys(){
global $wpdb;
$meta_query = $wpdb->get_results(
"
SELECT DISTINCT meta_key
FROM {$wpdb->postmeta}
"
, ARRAY_A );
$meta_keys = wp_list_pluck( $meta_query, 'meta_key' );
return $meta_keys;
}
This will return the list of all meta_keys associated to any post.
Related Posts:
- When should you use WP_Query vs query_posts() vs get_posts()?
- WP_Query vs get_posts
- Get posts by meta data OR title
- Can not switch the queried post in pre_get_posts hook
- WP_Query Performance Issues with meta_query
- WP_query category__in not working, only pulls from first category
- Get the post permalink within the loop but without additional DB query
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Creating a custom search for a specific post type
- Weird orderby => post__in issue
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- Check return value of get_posts
- Is it possible to query from external database? [duplicate]
- Specify strict ‘order by’ in WordPress query
- How to set up hierarchical relationships without using plugins / meta query
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- wpdb get_results() returns only 2 rows
- Ordering Posts by parent category, name ascending
- WP_Query always returning the last custom post
- When should you use WP_Query vs query_posts() vs get_posts()?
- Retrieve posts in custom post type and specific taxonomies
- A Depth Like Parameter For “get_posts”
- How to query for most viewed posts and show top 5
- Delete all posts from WordPress except latest X posts
- Differences Between WP_Query() and get_posts() for Querying Posts?
- What is the most efficient way of querying posts based on visits and date for current day?
- Add indexing to meta_value in wp_postmeta
- Custom WP_Query order by post_meta and (author) user_meta
- get_posts with multiple categories
- Use of caller_ get_ posts
- WP_Query for WooCommerce Products
- Slow SQL_CALC_FOUND_ROWS Query
- Export wordpress table to excel
- Perform query with meta_value date
- Order posts by tags count?
- Which custom query am I in and how can I access its properties & methods?
- Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
- How to find if a post with custom_field == X exists?
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- How do you query wordpress posts using a math formula between multiple meta field values?
- How do you Query posts with nothing in common?
- WP_Query, tax_query and term_meta: How to?
- What’s faster? One big query, or several smaller ones?
- Meta Query for specific months
- Different string for specifed post type on posts listing at homepage
- if/else on custom query gives 200 OK when condition not met?
- Order by custom table and multiplication
- Query all published post AND attachment with specific mime type
- only delete post within query / for each statement (front end)
- How to detect if query is runned from widget?
- Help with WP_Query – Too many mySQL queries
- How to display user order by role
- Show all data in database table and make it into an interactive table
- How to get list of posts from permalinks?
- Transient api Caches confused
- How can I override one post and make it display content for another post?
- Get all posts which was posted on X Days WordPress
- Get multiple users with meta value in one query and populate WP_User class
- get_posts always returning the same number of posts = 5
- Why posts array is empty?
- How to check the array values, what WP_Query has brought to me?
- How to add custom meta to ‘pre_get_terms’?
- Should I reset $wp_query?
- get_posts custom field
- How to apply a function to a metadata value before launch a WP Query?
- Posts query according to meta box date
- Get specific ACF key and value from all posts – no access to DB
- Woocommerce: order posts by meta key
- Retrieve data from wordpress db via input and put those result in dropdown
- How to access $wp_query object from array of posts given by get_posts?
- I am officially missing something about transient posts
- Start Query from 2nd Post without offset
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- Post incorrectly excluded when using “category__in”?
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Related posts queries
- How to extend WP_query to a specific table?
- How to query users by post count no less than 10
- WP_Query about meta_key and its array value
- Create global array to compare inside a query
- How to show terms from another taxonomy
- My entry results are not consistently alphabetized
- I cannot get tax_query in get_posts() to work with custom taxonomy
- Getting the last X posts, but in ascending order of time
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Custom query for tag and custom tag from 2 post type
- Filter posts/pages by user_role array
- Optimising amount of calls to custom fields
- Custom post types loop on a page template
- Get the number of rows from $wpdb->get_results not working
- Parsing External Table Arguments
- difference between methods of query
- Query posts by meta value and sort by another meta key
- how to use transient method?
- Custom WP_query in Jnews theme returns thousands of posts
- How to replecate the _fields parameter in custom REST api endpoint
- How to use meta_query to retrieve posts from multiple custom post type
- Rewrite URL custom search query