How to activate a plugin on the activation of a theme?

I highly doubt that what is happening is actually process of “activation” in WP terminology. What plugin is likely doing is just filtering data for what theme is currently active, without actually activating/deactivating (which would probably lead to chaotic collisions between different visitors). The easiest way to hide those shortcodes would probably be to make … Read more

Proper way to use plugin functions in functions.php

The active theme’s functions.php is included on the backend because a theme can be configurable from the backend. If your theme depends on the functions of a plug-in being available, then you must either make sure the plug-in is always available or make your theme robust enough to handle situations where it isn’t. You could … Read more

How to get menu location in wp_update_nav_menu hook

get_nav_menu_locations will give you menu IDs keyed by location which should correspond to the $id also passed with wp_update_nav_menu. add_action(‘wp_update_nav_menu’, function ($id, $data = NULL){ foreach( get_nav_menu_locations() as $location => $menu_id ){ if( $id == $menu_id ){ echo ‘location is ‘ . $location; } } }, 10, 2);

Do I have anything to worry about when switching to a default theme to test for plugin conflictions?

In a nutshell it is going to affect things, which has configuration specific to the current theme. Out of native functionality that would be most prominently: menus (which are assigned to theme locations) widgets (which are assigned to sidebars) This can go further if theme provides sidebars and custom widgets for example. Overall there are … Read more