Why are my custom metaboxes not updating the post meta?
Why are my custom metaboxes not updating the post meta?
Why are my custom metaboxes not updating the post meta?
I’m sure there’s a better approach, but this query should do what you want: SELECT DISTINCT meta_value FROM wp_postmeta pm WHERE meta_key = ‘Driver’ AND NOT EXISTS (SELECT * FROM wp_term_relationships tr JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id JOIN wp_terms t ON t.term_id = tt.term_id WHERE pm.post_id = tr.object_id AND tt.taxonomy = ‘category’ AND … Read more
I figured it out. Somehow in the import process a trailing space was added to the meta_key (making it “_thumbnail_id “). Mysql apparently matches on a trailing space which is why it wasn’t apparent, but once I removed the space all featured images started showing again.
Get the post meta unserialized (WordPress does this for you): $data = get_post_meta( $post_id, ‘name_of_field’, true ); Use a regular expression: if ( preg_match_all( ‘!https?://[^” ]+!’, $data, $matches ) ) print_r( $matches[0] );
Is your $ids array empty? Echo out each $idss to see if it contains a value. foreach ( $ids as $idss ) { echo $idss . ‘ <– ID<br>’; echo get_post_meta( $idss, ‘IMDB’, true ); }
It’s not clear why you mess with the global, under normal circumstances you don’t need to. Out of the box, when viewing a post page, get_post() will return current post object. Regardless of the loop even, since it is set up as part of main query before template is even reached. The difference between post … Read more
No, it does not have to be unique. Whether it’s a good practice to use it this way – that’s another question you can ask that plugin authors. Here’s the scenario: you have a slider in an entry slider has several slides each slide is stored as meta In this case, you will have couple … Read more
get_post_meta() calls get_metadata(), the parameter description of which says: $single (bool) (Optional) If true, return only the first value of the specified meta_key. This parameter has no effect if meta_key is not specified. Default value: false So, since you are passing ” as the meta_key, the $single parameter is ignored. Does that explain it? Edit: … Read more
You should use WordPress conditionals to determine which page you’re on, build the title based on that, then print the title. <?php $sep = ‘ | ‘; $name = get_bloginfo( ‘name’ ); if( is_home() || is_front_page() ) $title = $name . $sep . get_bloginfo( ‘description’ ); if( is_single() || is_page() ) $title = wp_title( $sep, … Read more
How do you sort the items in a custom taxonomy meta box?