I wrote this code in my functions file to automatically add page links to the nav menu if a plugin is activated. It works perfectly on my test server but pages don't load any content below the header on a live multisite installation.
add_filter('wp_nav_menu_items','add_about_page_to_menu', 10, 2);
function add_about_page_to_menu( $items, $args ) {
$url = home_url( 'about', 'relative' );
if( $args->theme_location == 'primary' )
if ( is_plugin_active( 'about-page-extension/about-page-extension.php' )
) {
return $items."<li><a href='$url'>About</a></li>";
}
return $items;
}
The main culprit seems to be if ( is_plugin_active( 'about-page-extension/about-page-extension.php' )
as the same issue isn't apparent when I change the code to exclude that part, although non functional.
Does anyone know how I can fix this?