• Resolved klihelp

    (@klihelp)


    WP-API doesn’t show any data for the registered custom menu location.

    
    // url/wp-json/wp/v2/menu-locations/nav-menu1
    {
    code: "rest_no_route",
    message: "No route was found matching the URL and request method",
    data: {
    status: 404
    }
    }
    
    // the plugin function.php
    //
    function mswp_register_menus(){
    
    	$theme_locations = get_option( MSWP_THEME_LOC_OPTION );
    
    	if( $theme_locations ){
    		foreach( $theme_locations as $loc ){
    			register_nav_menus( array(
    				$loc['slug'] => $loc['name']
    			) );
    		}
    	}
    }
    add_action( 'init', 'mswp_register_menus' , 20 );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP-API missing data for menu location’ is closed to new replies.