Saving of Draft is failing
Saving of Draft is failing
Saving of Draft is failing
Take a look at these lines to have an idea about adding the autosave feature: function hcf_save( $post_id ) { if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) { return; } if ( $parent_id = wp_is_post_revision( $post_id ) ) { $post_id = $parent_id; } $field_list = [ ‘hcf_author’, ‘hcf_published_date’, ‘hcf_price’, ]; foreach ( $field_list as … Read more
This can happen as you said there are some errors in code or if there is long or duplicate queries. Try to debug it with Query Monitor. Same reason if Safe button takes longer to get active.
See this answer for solution, see comments there about error messages. That should work with Classic editor. It could work with Gutenberg too, but it would need additional effort to get correct error messages. UPDATE: If using classic editor and preventing publishing of invalid records is enough, you can use this code: function my_save_post($post_id) { … Read more
I know this is kinda stupid solution, but 2s timeout is acceptable solution add_meta_box(“addanotheritem”, ‘Add another’, ‘addanother_metabox’, ‘custompost’, ‘side’, ‘high’); function addanother_metabox() { ?> <script type=”text/javascript”> function saveAndGo() { jQuery(‘button.editor-post-publish-button__button’).click(); setTimeout(function() { window.location=’./post-new.php?post_type=custompost’; }, 2000); return false; } </script> <button onclick=’javascript:saveAndGo();’>save & add another</button> <?php }
Save custom option in CSS file
On input, esc_url_raw() is the correct function to use which replaces sanitize_url Example : $custom_field = esc_url_raw( get_post_meta( get_the_ID(), ‘_custom_url’, true ) );
Two methods for disabling autosave is not working
There are a few methods to disable autosave/revisions. Disabling autosave: Using action and dequeuing the .js that is responsible for autosave, this goes into functions.php, located in the current theme directory. function bt_disable_autosave () { wp_deregister_script(‘autosave’); } add_action(‘admin_init’, ‘bt_disable_autosave’); Using a constant to set the interval so high (one day) it will never happen unless … Read more
If you look at the Cache Images plugin’s thumbnails page on the WordPress plugin directory it looks like this feature already exists within the plugin. In the admin section of your site go to Settings→Media there should be an option to cache images when posts are saved.