WordPress page error: Warning: include(): Filename cannot be empty in

I have a WordPress site that I’m developing locally – I am trying to create a new page with the permalink /jobs, however when I then try and preview the page I get the following error messages in the browser:

Warning: include(): Filename cannot be empty in /Applications/XAMPP/xamppfiles/htdocs/admiral_wp/wp-content/themes/fanatic/archive.php on line 6

Warning: include(): Failed opening '' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/admiral_wp/wp-content/themes/fanatic/archive.php on line 6

The archive.php can be seen in its entirety below:

<?php get_header(); ?>
<!-- +++archive -->
<main>
  <?php get_template_part( 'partials/partial' ); ?>
  <?php // Use include if variables need to be passed on to partial ?>
  <?php include(locate_template('partials/partial')); ?>

</main>
<?php get_footer(); ?>

If I change the permalink to anything else (e.g. jobss), it works fine and the page renders as expected, so the issue seems to be related specifically to the /jobs path. I thought that perhaps it was a reserved word, but there are no custom post types registered as jobs – although there is one called admiral_jobs which previously had a rewrite in its args, however this has now been removed ('rewrite' => array('slug' => 'jobs')) and I’m still getting the same error messages.

Any ideas on what else could be causing this error? Thanks

Answer

Navigate to Settings -> Permalinks and hit Save Changes button may resolve your issue.

Leave a Reply

Your email address will not be published. Required fields are marked *