Problem with php code to remove author page
-
I found this code while browsing the forum and implemented it inside my child-theme>>functions.php file and it seems to work.
add_action('template_redirect', 'my_custom_disable_author_page'); function my_custom_disable_author_page() { global $wp_query; if ( is_author() ) { $wp_query->set_404(); status_header(404); // Redirect to homepage // wp_redirect(get_option('home')); } }
However, I keep seeing this warning in my error logs:
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘remove_author_pages_page’ not found or invalid function name in /home/mywebsite/public_html/wp-includes/class-wp-hook.php on line 288
Can anyone shed some light on what I may have done wrong?
Thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Problem with php code to remove author page’ is closed to new replies.