How to display error messages using WP_Error class?

With that in functions.php you’d probably have to declare $error to be global like so : if (‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty($_POST[‘action’]) && $_POST[‘action’] == ‘registration’) { global $error; $error = new WP_Error(); // the rest of your code And then do global $error; again on your registration page before trying to use it. But … Read more

WP Cron and wp_insert_post

For those who stumble upon this later, use either option 1 or 2 found here: https://core.trac.wordpress.org/ticket/19373. “For other developers who run into this and need to work around it, either of these 2 options work: call wp_set_post_terms() to add your taxonomies after calling wp_insert_post() set up a “current user” in your script before calling wp_insert_post()”

error_log over 70GB. How to stop this? [closed]

Most important thing here would be to figure out what’s causing the errors as opposed to just hiding them. 70 GB file might be tough to open, so you can use tail to open up the last several lines of it tail -f error.log and see what’s going on. Maybe it’s a quick fix. If … Read more

wp_remote_get() not retrieving pages properly

The HTTP request sent by wp_remote_get() is different from the one that a browser sends. E.g the user-agent is different (see documentation). Some websites respond differently based on this. The second argument of wp_remote_get() allows one to alter the request. Websites might also respond differently depending on the IP or the number of requests received … Read more

When does remove_filter not work?

Well this is somehow a very specific topic that is bound to a WordPress development issue. I strongly suggest you to keep track of the trac ticket if you liked my article. That is the best thing you can do I assume for finding out when the problems come into play as well how to … Read more

How to fix ob_end_flush() error?

I also had this issue with wordpress and couldn’t properly resolve it. Ended up with this filthy hack to prevent the error from showing: // Get the current error reporting level $e_level = error_reporting(); // Turn off error reporting error_reporting(0); ob_start(); echo ‘This is a horrible hack’; $buffer_contents = ob_get_clean(); ob_end_flush(); // Reset error reporting … Read more

The seventh parameter passed to add_submenu_page()

I was able to track this down to the culprit function add_theme_page(). There There was an additional parameter, per the codex for add_theme_page() that needed to be removed. Removing that seemed to help. function fivehundred_register_admin_menu() { add_theme_page( ‘500 Settings’, ‘500 Settings’, ‘manage_options’, ‘theme-settings’, ‘fivehundred_admin_menu’, plugins_url( ‘/ignitiondeck/images/ignitiondeck-menu.png’ ) ); } add_action( ‘admin_menu’, ‘fivehundred_register_admin_menu’ ); Fixed code … Read more

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