• Resolved aadeemaanav

    (@aadeemaanav)


    I have made a very simple website (2 Pages) using WordPress Waterlava theme. My website contains many URLs, for which I haven’t created a page, but still they open up in the web browser.

    e.g.

    <my website URL>/author/user/

    <my website URL>/category/uncategorized/

    To block such URLs, I tried to comment template getter function names in array named $tag_templates defined inside template-loader.php. But this solution did not work. Any idea how I can solve this issue?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Yoga

    (@yogajegstudio)

    Hi @aadeemaanav

    To hide author/category page, you technically can use this code inside your theme’s functions.php :

    if ( ! function_exists( 'cusotom_disable_pages' ) ) {
    	function cusotom_disable_pages() {
    		if ( is_author() || is_category() ) {
    			wp_safe_redirect( home_url(), 301 );
    			exit;
    		}
    	}
    	add_action( 'template_redirect', 'my_custom_disable_author_page' );
    }
    

    BUT I recommend you to search for plugin that could hide pages
    instead of editing the code yourself, because it is easier and safer option.
    Also the codes above only hide author & category pages.

    Thread Starter aadeemaanav

    (@aadeemaanav)

    Thanks a lot @yogajegstudio

    Plugin Author Yoga

    (@yogajegstudio)

    You are welcome.
    I will close the topic now.
    Let me know if you have any other question.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to block unused URLs in Waterlava theme’ is closed to new replies.