Admin settings update updating every time home page is hit?

A much better hook to use would the the update_option_{option_name} dynamic hook, which only runs after your specific option has been updated. So something like: add_action(‘update_option_woocommerce_email_send_time’, ‘send_time’) function update_send_time() { // Add code here to update cron job } The only problem you’ll get here is that scheduling the cron job for a time earlier … Read more

What is an alternative method to the WordPress private _doing_it_wrong() function

What is an alternative method to the WordPress private _doing_it_wrong() function? There’s no way that WordPress is ever going to get rid of the _doing_it_wrong() function, so it’s perfectly safe to use it. But if for some reason you don’t want to use it because it’s marked private, then you could create a plugin that … Read more

Custom action button in Gutenberg editor (post_submitbox_misc_actions – equivalent)

wp_enqueue_script( ‘some-slug’, ‘/path/to/script.js’, array( ‘wp-edit-post’, ‘wp-plugins’, ‘wp-i18n’, ‘wp-element’ ), ‘0.1’ ); script.js: var el = wp.element.createElement; var __ = wp.i18n.__; var registerPlugin = wp.plugins.registerPlugin; var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; var TextControl = wp.components.TextControl; function MyPostStatusInfoPlugin({}) { return el( PluginPostStatusInfo, { className: ‘my-post-status-info’ }, el( TextControl, { name: ‘my_edit_summary’, label: __( ‘Edit summary’ ), help: __( ‘Briefly … Read more

Completely remove WP_Admin_Bar for specific user roles

Add the following to your functions.php file as detailed here. Disable Admin Bar for everyone: // Disable Admin Bar for everyone if (!function_exists(‘disable_admin_bar’)) { function disable_admin_bar() { // for the admin page remove_action(‘admin_footer’, ‘wp_admin_bar_render’, 1000); // for the front-end remove_action(‘wp_footer’, ‘wp_admin_bar_render’, 1000); // css override for the admin page function remove_admin_bar_style_backend() { echo ‘<style>body.admin-bar #wpcontent, … Read more

WordPress 4.5 deprecated get_currentuserinfo()

The answer lies within the wp_get_current_user() pluggable function. I simply changed the function name get_currentuserinfo() to wp_get_current_uesr() then made sure the returns were not boolean but return $current_user. This seems to be working well, including caching, etc. Hopefully this helps others. if ( ! function_exists( ‘wp_get_current_user’ ) ) : /** * This replacement function will … Read more

File not found.