Metabox not show in categories custom post type cmb2
Metabox not show in categories custom post type cmb2
Metabox not show in categories custom post type cmb2
I had a similar problem with a custom metabox. The problem was the use of $post_id inside the save-function. Using global $post and then $post->ID solved the problem for me. function save_metabox(){ global $post; if(defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE){ return $post->ID; } $myData = $_POST[‘my data’]; update_post_meta($post->ID;, $myData); }
From WP 3.7 you have the option to hook to the save_post hook directly for you post_type. For example: function update_post_parent_status_on_complete( $post_id ) { if(!isset($post)) $post = get_post($post_id); // checking the status you want and also that has a parent if ($post->post_status == ‘completed’ && $post->post_parent !=0 ){ $parent_id = $post->post_parent; update_post_meta($parent_id, ‘screening_status’, ‘screen’); } … Read more
I found out that actually, in a new Post creation, the Post Meta is not actually available yet! I was trying to get something that wasn’t available! Check – How to access the post meta of a post that has just been published? …. which says … “when you publish the post and ‘publish_post’ is … Read more
get_the_terms() is the function you need to get terms of a custom taxonomy associated to your post. It is similar (but not identical) to get_the_category() for the default category taxonomy. [Edited to answer the first comment below] Adapting the code you have for categories, here’s how you can display either categories or terms: <?php $categories … Read more
There is no official documented list of all possible post meta keys in core. The closest I could for anything unofficial was this answer on Stack Exchange: You probably don’t want to use the following post meta keys: _thumbnail_id – Used to store the featured image ID _edit_last – Used by the Heartbeat API _edit_lock … Read more
delete all post with certain meta_keys
result from custom filter admin table list backend does not work
Set default value field meta_Value [closed]
As the solution suggested in comments worked out for you, I’ll just post that as answer over here. You need to replace the_ID() function in your get_post_meta(the_ID(), ‘nova_price’, true); call. Because the_ID() directly outputs the post ID which is then getting printed for you instead of the meta. Right code would be: get_post_meta( get_the_ID(), ‘nova_price’, … Read more