comment_post_ID 0 (cannot remove from dashboard)

I’m sorry can’t comment here but i’ll try to help. wp_handle_comment_submission function handing comments posting contains exact check for post_id: $post = get_post( $comment_post_ID ); if ( empty( $post->comment_status ) ) { … return error_happened; } i.e. (1) it passes through , or (2) comment was added other than default way of posting comments. For … Read more

Add WordPress MU Network Admin via Database

So, it turns out that those three changes were all that were needed. It also turns out that if any of the serialized arrays are modified incorrectly (which is easy to do when modifying them by hand), the system will just assume you are not a network administrator. Correcting the serialized array for the site_admins … Read more

Connect to database using wordpress wp-config file

Using the defines the user sets in wp-config: mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); EDIT: Since your script is outside the WordPress environment, what you want to do is initiate it before using the defines in wp-config. require_once(‘./path/to/the/wp-config.php’); mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

Count & Display Database Queries

You can paste this block of code in your currently active WordPress theme functions.php file: function wpse_footer_db_queries(){ echo ‘<!– ‘.get_num_queries().’ queries in ‘.timer_stop(0).’ seconds. –>’.PHP_EOL; } add_action(‘wp_footer’, ‘wpse_footer_db_queries’); The above block of code, will render an HTML comment in the footer of your theme (before </body> and </html>, containing the number of database queries and … Read more

WordPress Database lost auto increment

I had a similar issue, I solved it and since this comes up high on Google for what I was looking for it may help others. I migrated several WordPress databases from AWS RDS MySQL to MySQL running on an EC2 instance, using the database migration service. What I didn’t know is it doesn’t copy … Read more