Forums

Wrong templates used for subpages whenever I edit /any/ page. (3 posts)

  1. rdcapasso
    Member
    Posted 5 months ago #

    Whenever I make an edit to any Page on my site, trying to hit any subpage on my site pulls up index.php rather than the template which I have assigned to the Page. That is, I see my index page content when I navigate to /page/subpage. I need to reset permalinks to default and then back to any custom config to get subpage templates working again.

    When I echo var_export($post) in index.php, sure enough, I see the info for the subpage to which I intended to navigate. So I know that the page is being called up but for some reason the correct template is not being applied until I reset permalinks.

    I've had a look at wp_postmeta and there doesn't seem to be anything awry with the template field there (it is still correct for those particular posts). My .htaccess file is read-only and contains the recommended WP settings only (paste of me catting it below):

    <br />
    $ cat .htaccess
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    I have been over "using permalinks" a few times and am at wits' end. Any help would be appreciated!

  2. rdcapasso
    Member
    Posted 5 months ago #

    Interestingly enough, I think this is an issue where after editing a page, WordPress wants to interpret $2 (in http://www.com/page/subpage/, it would be 'subpage') as a category name rather than a subpage name.

    When I get into this weird state, if I go to http://my.site.com/anyurl?pagename=page/subpage, I get the correct page template and all associated content.

  3. rdcapasso
    Member
    Posted 5 months ago #

    I was able to get page/subpage URLs to work by adding a rewrite rule:

    array('page/([^/]+)/?$' => 'index.php?pagename=page/$matches[1]');

    Where $matches[1] is the subpage.

Reply

You must log in to post.

About this Topic