Problem with wp_update_post

The first argument of array_merge is the array of old values pulled from the original post, not your new values, so I’d guess you’re passing an invalid post ID. In your array of new values, I think you want to set post ID to $page_check_404->ID, not $ss_404_post_id.

Automatically insert php function into post $the_content

I’m sure you want to use the_content filter instead of the default_content filter (already mentioned by @jgraup) because what happens if the generated HTML changes? Then you’re stuck with it in your content. It’s better to add it dynamically. Here’s one suggestion: add_filter( ‘the_content’, function( $content) { if( ! in_the_loop() ) return $content; if( ‘property’ … Read more

What does wp_update_post() do that the $wpdb class does not?

wp_update_post() calls some hooks that $wpdb doesn’t on it’s own. You’ll have to do it on your own to make it compatible with other plugins. wp_update_post() calls some functions related to database entry sanitation, thumbnails, attachments, time (format, zone etc.), comment, taxonomy, meta, cache etc. So if you use $wpdb, make sure you handle all … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)