get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post
get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post
get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post
This worked for me as long as it’s run only on the appropriate query. The key is MySQL’s FIELD() function, which lets you specify an arbitrary ordering. add_action( ‘pre_get_posts’, ‘add_match_times_to_query’ ); function add_match_times_to_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( ‘match_time’ => array( ‘key’ => ‘match_time’, ‘compare’ => ‘EXISTS’, … Read more
Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
I you need to use update_post_meta($post_id,’your_meta_key’,’your_meta_value’); or you can save in new variable like $city_value = $_POST[‘city_field’]; then code will be update_post_meta($post_id,’city_field’,$city_value);
What effect can a large wp_post table have on overall site performance?
NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
A custom post_type is a type of post that has a unique name, like ‘event’ or ‘book’ depending on the type of object you are needing. This can be anything. The post_type ‘post’ is a built in WP post_type and concerns only blog posts in the “Posts” panel of the admin area. Add ‘post_type’ => … Read more
Updating order meta to have a meta entry from an item in the order
If I understood correctly, I believe this will help you to get what you’re after. I can’t verify it works, but reading it should give some guidance: function my_plugin_verify() { // ————————————————————————– // 1) I’m checking if the user is logged in if (!is_user_logged_in()) return false; // NOT VERIFIED // ————————————————————————– // 2) if he … Read more
Does this meta field store some other post’s ID, of which you want to retrieve the post name? If so, try this <?php global $post; $customlink = get_post_meta( $post->ID, ‘clink’, true ); echo get_post_field( ‘post_name’, $customlink ); ?>