• Resolved Clivesmith

    (@clivesmith)


    If you use your website name then /menu/menuitem it shows up as an unformatted page, can I stop this ?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support dimned

    (@dimned)

    Hi @clivesmith,
    This is a default archive page. You may disable it via the code or by enabling a redirection.

    Thread Starter Clivesmith

    (@clivesmith)

    Thanks Dmytro,

    It will show it for every menu item, could you tell me how to stop it via code please.

    Clive

    • This reply was modified 4 years, 5 months ago by Clivesmith.
    Thread Starter Clivesmith

    (@clivesmith)

    OK So this is what I think you mean

    function redirect_to_home( $query ){
    if(is_single() ) {
    wp_redirect( home_url() );
    exit;
    }
    }
    add_action( ‘parse_query’, ‘redirect_to_home’ );

    I don’t see any reason to want to see “archive” pages like that, it breaks all my page formatting. Should this be standard unless asked for ?

    Clive

    • This reply was modified 4 years, 5 months ago by Clivesmith.
    Plugin Support dimned

    (@dimned)

    Hi @clivesmith,
    You may try to add this code to functions.php of your theme

    function mp_menu_items_adjust_cpt( $args, $post_type ) {
    	if ( 'mp_menu_item' !== $post_type ) {
    		return $args;
    	}
    	$args = array(
    		'has_archive' => false,
    	);
    	return array_merge( $args );
    }
    add_filter( 'register_post_type_args', 'mp_menu_items_adjust_cpt', 10, 2 );
    Thread Starter Clivesmith

    (@clivesmith)

    Thank you Dmytro, but that just gives me a critical error

    • This reply was modified 4 years, 4 months ago by Clivesmith.
    Plugin Support dimned

    (@dimned)

    Hi @clivesmith,
    Make sure you have copied the full code and did not miss any symbol. I do not experience any errors locally.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Each menu item can be viewed as a page’ is closed to new replies.