Is there a canonical way for a plugin to install a mu-plugin or drop-in?

There are no canonical methods for doing this, and in many cases it’s undesirable. E.g. more than one plugin may want to override a drop in. You might also be reaching into and modifying files that are managed by the hosting company, which might either break things or trigger problems. Instead, you should disable any … Read more

how can a plugin return an error message on activation?

I use code similar to this to check for the minimum requirements for a plugin: if (is_admin()) { // check for required versions of WP and PHP $min_wp = ‘4.9.6’; $min_php = ‘7.2’; if (!check_requirements($min_wp, $min_php)) { add_action(‘admin_init’, ‘my_disable_plugin’); add_action(‘admin_notices’, ‘my_show_notice_disabled_plugin’); add_action(‘network_admin_init’, ‘my_disable_plugin’); add_action(‘network_admin_notices’, ‘my_show_notice_disabled_plugin’); my_deregister(); return; } } function check_requirements($min_wp, $min_php) { // see … Read more

how to mage the submenu open on wordpress active page

When on the Corporate profile page, that menu item has the following classes: current_page_item current-menu-ancestor current_page_ancestor. Any of these are attached to a menu item when you are on that page, or a child page. Target these in your stylesheet, and set the .sub-container div to have display:block;. That should do the trick. Also, your … Read more

Activate plugins by a theme’s functions.php?

Write This Code On theme Function.php function run_activate_plugin( $plugin ) { $current = get_option( ‘active_plugins’ ); $plugin = plugin_basename( trim( $plugin ) ); if ( !in_array( $plugin, $current ) ) { $current[] = $plugin; sort( $current ); do_action( ‘activate_plugin’, trim( $plugin ) ); update_option( ‘active_plugins’, $current ); do_action( ‘activate_’ . trim( $plugin ) ); do_action( … Read more