Disable single menu item page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45646
    Yads
    Participant

      Hi,

      How can i disable single menu item page?
      eg.
      https://www.example.com/wppizza/136-chicken-tandoori/

      i see these pages in google for my website and i dont want to show it to user. How can i block navigation to this?

      Thanks
      Yads

      #45649
      Olly
      Admin & Mod

        I have of course no knowledge of the exact inner workings of googles algorithms (or any other searchengines for that matter)
        so I may be off base here, generally though and as far as I am aware they do not index pages that are not linked to from anywhere.
        So my first question/guest would be that perhaps you have some sitemap indexing plugin installed that indiscriminately indexes pages of your site and adds them to the sitemap regardless of whether that’s a good thing or not.
        Typically sitemap generators should also be able to let you specify which pages/posts/custom post type to index so if you are using this kind of plugin , that’s where I’d look first.

        As mentioned though I do not know the inner workings of google et al, so perhaps there is also some other source where and how searchengines find all your pages , even the ones you are not linking to from anywhere on your site, so not withstanfing what I said about sitemap plugins, I would suggest one of the following 2 options

        a) (kind of the opposite of what you are asking , but for completeness sake)
        *DO* in fact create some single pages that work with your theme as outlined here, ( https://docs.wp-pizza.com/developers/?section=wppizza-markup-single-single-php ) so the single item pages also allow products to be added to the cart (might even be beneficial from an SEO perspective)

        b) disable those single item pages by adding the following filter to your functions.php
        (a basic filters overview can be found here https://docs.wp-pizza.com/developers/?section=filters-actions-functions)

        
        //option1 : redirecting to homepage 
        add_filter('wppizza_filter_cpt_args', 'myprefix_myfunctionname');
        function myprefix_myfunctionname($args){
        $args['publicly_queryable'] = false;
        return $args;
        }
        //option2 : will result in a 404
        add_filter('wppizza_filter_cpt_args', 'myprefix_myfunctionname');
        function myprefix_myfunctionname($args){
        $args['publicly_queryable'] = false;
        $args['query_var'] = false;
        return $args;
        }
        

        (adjusting myprefix_myfunctionname as per your liking). If using one of these 2 filters, you should also re-save your permalink structure in WordPressAdmin -> Settings -> Permalinks ([your.domain.com]/wp-admin/options-permalink.php) after adding

        Hope that helps

        #45853
        mps1
        Participant

          I simply no index the WP Pizza Menu Items in my SEO plugin in WordPress and they do not show up in Google

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The topic ‘Disable single menu item page’ is closed to new replies.