Is it save to require plugin.php early to be able to use get_plugin_data() earlier?

At first glance it works and I cannot see any implications but maybe you are aware of some? You say that you are not getting errors, which I would have expected but it looks as though WordPress uses require_once() so you are probably safe: 39 /** WordPress Plugin Administration API */ 40 require_once(ABSPATH . ‘wp-admin/includes/plugin.php’); … Read more

Disable slow media queries?

Solution for WordPress versions >= 4.7.4 (4.8) Ticket #31071 introduces patches with new filters to override three possible slow media queries, in the wp_enqueue_media() function: media_library_show_audio_playlist (@param bool|null) From the inline doc: Whether to show the button, or null to decide based on whether any audio files exist in the media library. media_library_show_video_playlist (@param bool|null) … Read more

Set “Display name publicly as” to be usernames by default

If you want this for all future users then hook into the user_register event and update it there. Pull the WP_User using get_userdata and wp_update_user info with the new display name. add_action( ‘user_register’, ‘wpse_20160110_user_register’, 10, 1 ); function wpse_20160110_user_register ( $user_id ) { // get the user data $user_info = get_userdata( $user_id ); // pick … Read more

Categories box not showing on post edit pages

For all who have the problem just with WordPress Blocks/Gutenberg, here is the solution I was looking for a long time. When you create a new taxonomy, make sure you’ve set show_in_rest to true. Otherwise it will not appear in Block editor. https://developer.wordpress.org/reference/functions/register_taxonomy/ Whether to include the taxonomy in the REST API. Set this to … Read more

Upgrade to SSL Breaks Admin Dashboard

Not sure what plugin you are using to enforce SSL, but I would disable it to prevent conflicts with the possible solution below. To make sure you’ve updated all of your URLs to the HTTPS, do the following: Go and download Interconnect IT’s Database Search & Replace Script here Unzip the file and drop the … Read more

How to remove/hide action links cluttering under specific plugins’ names

You have the right approach. You will want to use the admin_enqueue_scripts hook: add_action( ‘admin_enqueue_scripts’, ‘wpse_239302_hide_action_links’ ); function wpse_239302_hide_action_links() { global $pagenow; if ( $pagenow == ‘plugins.php’ ) { ?> <style type=”text/css”> .visible .proupgrade, .visible .docs, .visible .forum, .visible .jetpack-home, .visible .support { display: none; } </style> <?php } }

How to show an error message after publishing a post?

I wouldn’t use that hook. Here’s why Try something like this using admin_notices. function wpsites_admin_notice() { $screen = get_current_screen(); if( ‘post’ == $screen->post_type && ‘edit’ == $screen->base ){ ?> <div class=”error”> <p><?php _e( ‘Updated Demo Message!’, ‘wpsites’ ); ?></p> </div> <?php }} add_action( ‘admin_notices’, ‘wpsites_admin_notice’ ); Untested.

Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress

If WordPress is loaded from outside of the main WordPress files using a separate PHP script that includes wp-load.php then the /template-loader.php file will not be loaded and therefore the template_redirect action will not be triggered. This is important because template_redirect is how the Toolbar is initialized on the front end. Taking a look at … Read more