save_post action inside a custom metabox class not working

I have modified your code as following and it is working for me. I have removed the constructor from your code and added the code in method and called that method using object. if (is_admin()){ add_action(‘load-post.php’, array(‘Mighty_Metabox’ , ‘Custom_Mighty_Metabox’)); } //the class class Mighty_Metabox{ //the vars public $id = false; public $title = false; public … Read more

Perform function on publish AND save (not just save)

Instead of taking meta values from get_post_meta function take it from $postarr array because when initial publishing of the post there isn’t any values for event_datestart and venue_name in database and it returns empty string. Updated Code : function set_event_title( $data , $postarr ) { if($data[‘post_type’] == ‘event’) { $getdate = $postarr[‘event_datestart’]; // Replace event_datestart … Read more

Save custom value to main content of post

The answer appears to be clear if you look at the source code. The action you’re hooking to occurs inside wp_insert_post, and is called just before it returns the $post_ID variable. This means that all the manipulation and data insertion has already taken place, so modifying the $_POST array will do nothing. You must look … Read more

Custom wp_editor doesn’t update post_content

After some searching and working off of some pointers from toscho, and some other helpful posts to avoid an infinite loop I managed to figure out a solution. I’ll post the code below then briefly explain: // Hook into the actions here public function __construct() { add_action( ‘add_meta_boxes’, array($this, ‘meta_boxes’ )); add_action( ‘save_post’, array($this, ‘save_bio_data’ … Read more

Update Post Taxonomy Automatically Based On Date

You just need to set it up like this: if ( ! wp_next_scheduled( ‘check_event_status’ ) ) { wp_schedule_event( time(), ‘daily’, ‘check_event_status’ ); } add_action( ‘check_event_status’, ‘set_event_status’ ); install the Debug bar plugin and add the cron extension for it if You need some debuging info about the cron job and to be able to manually … Read more