How to get a post meta value and pass that to update_option when a post is created or updated?
How to get a post meta value and pass that to update_option when a post is created or updated?
How to get a post meta value and pass that to update_option when a post is created or updated?
To modify the content of a post, you can use the_content filter. You (probably) only want to add the post meta to the main query. If not, you can skip the is_main_query() conditional. Then you can just get the post meta and format it how you see fit and append it to the content. //* … Read more
To follow-up on the comment made by @mmm, you’ve got a number of statements like: if ( ! isset ($_POST[‘drw_event_date_field’] ) ) { return ; update_post_meta ($post_id, ‘_event_date_valkey’, $event_date) ; } Notice that you are wrapping your calls to update_post_meta() inside the !isset() conditionals. What you want is: if ( ! isset ($_POST[‘drw_event_date_field’] ) ) … Read more
Yes, You can call action “pre_get_posts”. add_action(‘pre_get_posts’,’search_filter’); You can add parameter : $args = array( ‘post_status’ => ‘publish’, ‘posts_per_page’ => 6, ‘paged’ => $paged, ‘meta_key’ => ‘event_date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); You can use above parameter e.g. : function search_filter($query){ if ( !is_admin() && $query->is_main_query() ) { $query->set(‘post_status’, ‘publish’); $query->set(‘meta_key’, ‘event_date’); $query->set(‘orderby’, … Read more
Grab meta data before post is saved
The meta_query parameter always need to be an array of array and should be written like this “meta_query” => array( array( “key” => “_fixtures”, “value” => $fixguid, “compare” => “=” ) In fact, the array of array is use to serve to any relation when you want to query multiple metas, but it’s need even … Read more
How do you sort the items in a custom taxonomy meta box?
Found an answer. My posts were all in status “private”, and by default only the posts with “publish” status are taken.
You can do it using repeater field of advanced custom field plugin. See example
Saving post meta