Save post in another table
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.
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
I’ve had the same issue recently. Inline styles, as well as <img> tags, would cause the 410 Gone status and error message (The requested resource /wp-admin/post.php is no longer available on this server and there is no forwarding address. Please remove all references to this resource. upon previewing or publishing the post. The problem was … Read more
Use the set_object_terms hook, http://adambrown.info/p/wp_hooks/hook/set_object_terms?version=3.4&file=wp-includes/taxonomy.php It should be fired when a post or page is modified. Here is the code that fires it: do_action(‘set_object_terms’, $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids); You can thus check against the $object_id and taxonomy, and flush your transient cache and regenerate as needed. Specifically, clear the term caches of the … Read more