How to hide Category and Services pages

Hi,

My website is designed as a single static front page using the Sydney theme. Since the website is for purely for information, this page is the only thing that I want my visitors to be able to access.

The page is made up of separate sections using testimonial, services (in different categories), clients and testimonials. I do not use posts, projects, employees or comments.

The front page works works fine. However, I have just discovered that as well as having the static front page, I can also access pages for categories, services, employees, projects, clients and testimonials by typing in the address bar. Some of these pages are generating soft 404 errors which is how I have found them.

Is there a way using CSS to stop these pages from being accessible?

Thanks.

Hello,

First thanks for using our theme!

Please try the steps below:

  1. Install and activate Code Snippets plugin plugin
  2. Add a new snippet and paste the code below in the box:

    function redirect_all_pages_to_home() {
        if ( ! is_front_page() ) {
            wp_redirect( get_home_url() );
            exit;
        }
    }
    add_action( 'template_redirect', 'redirect_all_pages_to_home' );


  1. Check to run only on the site front-end

  1. Save and activate the snippet.

We hope this helps!

Please try that and let us know if you need further assistance.

Kind Regards,

Rodrigo.

aThemes Support

Hi Rodrigo,

Thanks for your reply.

I followed the suggestions you made and can report back that your solution has worked perfectly.

I really appreciate your assistance here.

Best regards,

Matthew

Hello Matthew,

You are welcome!

If you are satisfied with our theme and support, would be great if you leave your comment and rating in the offical WordPress Themes repository. That helps us a lot: [Sydney] Reviews | WordPress.org

Let us know if you need further assistance.

Kind Regards,

Rodrigo.

aThemes Support