Hello there,
To restrict direct access to the registered custom post types of Sydney Toolbox plugin, try adding the below function to your child theme’s functions.php file. Or you can use a functionality plugin like Code Snippets without running a child theme.
function sydney_child_modify_cpt( $args, $post_type ) {
$custom_args = array();
$custom_args['public'] = false;
$custom_args['has_archive'] = false;
$custom_args['publicaly_queryable'] = false;
$custom_args['query_var'] = false;
switch ($post_type) {
case 'services': // Services
case 'employees': // Employees
case 'testimonials': // Testimonials
case 'clients': // Clients
case 'projects': // Projects
$args = array_merge( $args, $custom_args );
break;
}
return $args;
}
add_filter( 'register_post_type_args', 'sydney_child_modify_cpt', 10, 2 );
The links might still appear on Google Search due to cached queries. Thus you’d need to manually remove them from Google. For links that might be found by visitors will be returned not found page. You might want redirect them to home page with this plugin.
Regards,
Kharis