wp_update_post meta causing 500 error

I was able to find a solution by following the advice in this article (https://www.godaddy.com/community/Building-and-Managing-a-Website/fatal-error/td-p/31814): Open your hosting account, go to File manager and access this folder: wp-content Rename this file object-cache.php to object-cache-OLD.php As a developer I don’t know how to prevent this for future clients without a greater understanding. Comments and new answers … Read more

wp_update_post creating revisions instead of updating the post

check: https://codex.wordpress.org/Function_Reference/wp_update_post Make sure not to create an infinite loop. <?php function my_function( $post_id ){ if ( ! wp_is_post_revision( $post_id ) ){ // unhook this function so it doesn’t loop infinitely remove_action(‘save_post’, ‘my_function’); // update the post, which calls save_post again wp_update_post( $my_args ); // re-hook this function add_action(‘save_post’, ‘my_function’); } } add_action(‘save_post’, ‘my_function’); ?> … Read more

Custom Meta Box (SELECT2) Not Saving Taxonomy Terms

First of all you saved the the terms value in a post meta table and not following the wordpress conventional method. To make it connect with default category with that post you need to modify your save_post action. Check the modified code. add_action( ‘save_post’, ‘rudr_save_metaboxdata’, 10, 2 ); function rudr_save_metaboxdata( $post_id, $post ) { if … Read more

Why does wp_update_post causes white screen?

When commenting out wp_update_post( $post ), the update_post_meta is working fine. Yes, the problem is not with update_post_meta(), but it is wp_update_post() because it uses wp_insert_post() which fires the save_post_foglalas hook (i.e. save_post_<post type>), and because your function calls wp_update_post(), then your function gets called infinitely and eventually caused the White Screen Of Death (WSOD). … Read more