I have no experience with the get_{$meta_type}_metadata
filter either, hence all I can offer is a further approach to a possible workaround:
Iff you don’t need to satisfy third parties using get_post_meta
, but only want to use the filter in your own code, you could write a custom wrapper for get_post_meta
, which in turn will accept a filter:
function wpse94639_get_post_meta( $post_id, $key = '', $single = false ) {
$metadata = get_post_meta( $post_id, $key, $single );
return apply_filters( 'wpse94639', $metadata );
}
Now you could use add_filter( 'wpse94639', 'my_add_a_class_function' );
.
This is only a viable solution, iff you don’t need to filter results when some other theme/plugin is using the original get_post_meta
, obviously.
Related Posts:
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Is there any action filter/hook for validating a custom field before publishing the post?
- Filter WP_Query for posts having a certain meta-value
- Apply the_content filter to a custom field with multiple values
- Pass all custom fields through the same filter on post load?
- Filter results with custom field values and dropdown
- Archive sorting functions by custom fields (front-end)
- Change content before writing to database
- WordPress Search Custom Meta Field Only
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Using custom fields in a filter hook
- Add an advert every nth Paragraph
- How to filter a dd/mm/yyyy date from a custom field in a query
- Force hide custom field metaboxes
- Saving custom profile fields
- Update posts after populating ACF field value [closed]
- How to validate custom field on lost password form before the user id field?
- filtering custom post types via meta data drop down
- How to order posts by one custom field and filter them by another one?
- Filter multiple custom fields Values with Check boxes
- How to get categories with posts by custom field value?
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- Best filter to use for modifying custom fields on a post?
- How to display childrens custom fields?
- Access ACF fields within custom preview function?
- Sort posts by clicks on download button
- Let Users Filter Posts by Custom Fields
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- Footnotes in custom fields
- How to change permalink on headlines in rss feeds?
- How to change order of posts in admin
- How to query posts by month based on date custom field?
- Filter or order based on custom field
- How to show ACF fields in Gridbuilder custom block
- WP meta_query args not working in function
- User Filter Options on Archive Page
- How to add content with a filter when there’s no content in the editor
- change attachment custom field onChange event
- Filter and display a specific custom field value [closed]
- How to filter post using custom feild value in shortest and longest duration?
- Query Posts Via WordPress URL
- Create widget that filters posts on current page based on entered value
- Including inline Custom Fields info with add_filter in functions.php
- Sort posts after filtering them through multiple taxonomies
- Set new url from custom post field
- How to enable custom fields for pages (if not a bad practice)?
- Custom per-page sidebar widgets .. possible?
- How to add new custom page or post blocks?
- Transients vs CRON +Custom Fields: Caching Data Per Post
- How to update serialized data in the user meta data
- Unable to save datetime custom meta field using update_post_meta() function
- Guest Author – How can I use custom fields to create guest author link?
- enabling custom fields in admin?
- Using WP Query to search by multiple meta fields
- Get aggregate list of all custom fields for entire blog
- How to Identify the Source of a Custom Field?
- two custom fields question
- How to save multiple options from a dropdown in user profile
- How to display multiple images in custom field
- How to show a gloabl message on a user profile page (in back end)?
- Front-end editing with custom fields?
- If meta key exists in get posts function otherwise create it
- How do i save and retrieve custom attachment meta?
- Show values of dynamically created custom meta keys
- List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop
- Filter by custom field (meta_key) using JSON API
- Bulk append custom field to post content
- More efficient to add content to custom fields or the content area?
- Custom field query without duplicates results
- how to display an excerpt of the latest post on the homepage?
- Vimeo thumbnails
- querying a custom field
- meta_value and meta_key filtering returning no posts [closed]
- Woocommerce Retrieving custom field value from orders
- If one meta key value is empty, try to get another meta key, and if both meta keys are empty show something else?
- How to order posts by number of Vimeo Likes
- Displaying a video on the homepage via a custom field inside a php widget
- Displaying custom field meta within WP_query loop
- how to create meta key name in wp_usermeta table in database
- Display the output from Custom User Fields from a WordPress user profile on a WordPress Custom Page
- get_field values for each post on home page using wp_add_inline_style
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Is there a way to determine which user changed a custom field (and when)?
- Metabox/Custom fields are not saving input data
- Show image depending on the number in the custom fields
- Show echo ready in single.php
- Save, update, get and sanitize post meta as HTML not plain
- Order categories by sum of custom fields
- how to modify a field’s size in a metabox : ROWS height, and scroll control?
- Saved Post Meta Array Returns as String
- Thirtieth century date for a post
- Custom field in external Javascript
- Analyze uploaded images to get colour values
- Turn Current Date in Custom Field Ouput Green or Red
- added a meta box to post however when saving menu while debug on throws a warning
- How can i get the actor birthday by date?
- Make Custom Fields Public in JSON – API
- How to pass value to add_filter wpcf7_form_tag from another function?
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?