Metabox is not saving
Metabox is not saving
Metabox is not saving
I was able to solve my problem by calling set_post_format in my save_post callback and making sure to check if its set and not equal to the “no change” option. Not sure if this is the best way to go, but it works. require( plugin_admin_dir . ‘plugin-sync.php’ ); add_action( ‘save_post’, ‘savethepost’, 2000); function savethepost($post_id) { … Read more
Refer to Creating a new PostBox in WordPress. As long as you name the fields the same in render as you do in save then you’re good. RENDER echo ‘<input type=”text” id=”boxpost_meta_field” name=”boxpost_meta_field”‘; SAVE $mydata = sanitize_text_field( $_POST[‘boxpost_meta_field’] ); // Update the meta field. update_post_meta( $post_id, ‘_boxpost_meta_field_value_key’, $mydata ); GET $value = get_post_meta( $post->ID, ‘_boxpost_meta_field_value_key’, … Read more
To solve your magic question(s) you might need a little chain of processes, or just do something obvious simple. If I understand right, in the end, the current post you are saving, gonna change its slug (url) by pushing any “belonging” term name into the post url (slug)? Scenario A) If it is NOT a … Read more
The problem was due to a security setting in the server (Apache). Changed a rule and voilà!
While clicking ADD-NEW (i mean when creating new post), it has already assigned an ID. You can catch it using javascript,like: if(document.getElementById(“postID”)){ alert(document.getElementById(“postID”)); } or catch it using PHP: var_dump($GLOBALS); and see the variable name
I think you inject some code to display your custom button. You can try to add the save post action in your code: do_action(‘save_post’); And then add redirect code, be carefull with the Infinite loop.
You can create for each Event a custom post meta (example event_users) where you will save the users ID’s that clicks the “I’m interested in this event” Something like: $event_users = get_post_meta($event_id, ‘event_users’, true); // Get exisitig event users $event_users[$user_id] = 1; // Add user ID as a KEY, a simple way to make sure … Read more
That is structure not the unique slug of the post or category. And that has nothing to do with the URL. You can add post with same slug if there are different post_type/pages/post.
So yes, the problem is not with the saving, it’s how you load the saved data back… See the documentation for get_post_meta: if you dont’ provide a meta data key, the function returns all meta data for that post – which has to be returned as an array. Try this instead: $littlereds_storedMeta = get_post_meta($post->ID, ‘catagory’, … Read more