Fatal error: Cannot redeclare exclude_category()
-
Hi Everyone
So, I wanted to exclude a category from the homepage so I added this into functions.php:
function exclude_category($query) {
if ( $query->is_home ) {
$query->set(‘cat’, ‘-xx’);
}
return $query;
}
add_filter(‘pre_get_posts’, ‘exclude_category’);..with the relevant number replacing -xx. It worked fine with the first one and the second one I tried, I got the following error.
Fatal error: Cannot redeclare exclude_category() (previously declared in /home/content/11/7101111/html/wp-content/themes/inexqueerienced_theme12/functions.php:717) in /home/content/11/7101111/html/wp-content/themes/inexqueerienced_theme12/functions.php on line 730
I think I know the problem: I hadn’t resolved the script and perhaps deleted the <?php etc. Anyway, I can’t get on ANY pages, even my site homepage so I can’t log back in to correct the issue. I just get that error. Is there a way to log in maybe my proxy or something?
Otherwise, I think my site it forever in lock-down!
If anyone can help, that would be great!
- The topic ‘Fatal error: Cannot redeclare exclude_category()’ is closed to new replies.