draft_to_pending action doesn’t seem to fire
You might not have all the right actions covered, try to add those: add_action(‘new_to_pending’, ‘notify_email_rejected’); add_action(‘auto-draft_to_pending’, ‘notify_email_rejected’);
You might not have all the right actions covered, try to add those: add_action(‘new_to_pending’, ‘notify_email_rejected’); add_action(‘auto-draft_to_pending’, ‘notify_email_rejected’);
In my experience this happens when you initiate an operation (Save/Update) and then try to leave the page to do something else before the requested operation has completed. Next time you save/update a post wait until the edit page returns to normal and displays your content. Then navigate away from the edit page. Chances are … Read more
The original post_date is saved post_date and post_date_gmt. And modification dates are saved on post_modified_date and post_modified_date_gmt. So you never lose your original creation date.
Doing something like this would help make sure the theme object has been instantiated properly… global $theme_options; if ( (!isset($theme_options) || (!is_object($theme_options)) ) { $theme_options = new My_Theme_Options_Class(); }
The wp_update_post hook will call the same action twice, as the action save_post_{$post->post_type} is called in this function. I would add remove_action( ‘save_post_tribe_events’, ‘set_to_pending’); before wp_update_post( $post ); and add_action( ‘save_post_tribe_events’, ‘set_to_pending’, 10, 3 ); after it works 🙂 function set_to_pending($id, $post, $update){ $the_post = print_r($post, true); $the_post_author = $post->post_author; $the_post_url = get_edit_post_link($id); $the_post_url = … Read more
Classic Editor: autosave.js file setInterval(function () {document.getElementById(“publish”).click()}, 300000); php function // Load js file on specific post type in class editor function load_js_file_classic_editor( $hook ) { global $post; if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) { if ( ‘post’ === $post->post_type ) { wp_enqueue_script( ‘myautosave’, get_stylesheet_directory_uri().’/includes/js/autosave.js’ ); } } } add_action( ‘admin_enqueue_scripts’, … Read more
It comes from wp_insert_post(), where do_action() is called with two additional parameters: do_action(‘save_post’, $post_ID, $post); So it is not you who adds the parameters, it is WordPress. If you register your callback with the fourth parameter set to 2 … add_action( ‘save_post’, ‘mytestfunc’, 10, 2 ); … you will even get the complete $post object: … Read more
Of course your custom posts can’t be trashed. They can’t even get set to private or draft or anything else then publish because your callback change_content() always sets the post status to publish every time a post (of your custom post type) gets saved. However trashing a post just means setting its status to trash. … Read more
Yes, whenever a post is saved you should see all of the input items in $_POST … if you’re not using something like xdebug to debug with, you could do something like: echo “<pre>”; var_dump( $_POST ); echo “</pre>”; To test and see what is all included in $_POST … note this is just for … Read more
The technical side of it depends on the storage used. For default database storage the transient entries can be queried and deleted, since they have specific naming format. For enabled Object Cache storage cache can be flushed, which will get got cache and transient. The practical side of it — this is Bad Idea. Transients … Read more