WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 404 - new page without parent (9 posts)

  1. jacobvanpouderoijen
    Member
    Posted 10 months ago #

    Hello,

    When I add a new page to my wordpress installation I have no problems unless when I decide this page doesn't need a parent page. Every page without a parent works fine, and existing pages without parent also work fine.

    When I choose that I get the wordpress 404 (not the server's 404). I suspect that this is because of my permalink structure (/%year%/%monthnum%/%postname%/). When I set this to default the page is reachable.

    I tried the following:
    - Delete .htaccess
    - Reset permalinks and change it back to the desired version
    - Add following code to .htaccess

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    http://www.risk-direct.nl/consument/ (working)
    http://www.risk-direct.nl/risk-assuradeuren (not working)

  2. esmi
    Forum Moderator
    Posted 10 months ago #

    Can you replicate the problem using the default Twenty Thirteen theme with all plugins deactivated?

  3. jacobvanpouderoijen
    Member
    Posted 8 months ago #

    Extra information:
    -the website is running under IIS 6.0 with ISAPI

    The problem still remains when I export all my pages etc and import them into a clean install with the same theme.

    Changing the theme indeed solves this problem, which leads me to believe that my theme messes up somewhere (it's the theme of my predecessor, not my own creation), but I have no clue where to even start looking for this.

  4. esmi
    Forum Moderator
    Posted 8 months ago #

    which leads me to believe that my theme messes up somewhere

    Yep - it sounds like the theme is the problem. Where did you download it from?

  5. jacobvanpouderoijen
    Member
    Posted 8 months ago #

    It was custom created by one of the employers that used to work here before me.

    I assume the following happens:

    1) URL happens
    2) WordPress catches call and starts to search in the database
    3) Reference somehow not found
    4) 404 Error

    I checked by using statements if it even tried to load the templatepage assigned to the page, but it doesnt get there

    P.S. it is a multisite with domainmapping

  6. esmi
    Forum Moderator
    Posted 8 months ago #

    Try checking your site's error logs for messages/clues. Your hosts should be able to help you accessing your site's error logs.

  7. jacobvanpouderoijen
    Member
    Posted 8 months ago #

    Thanks, Ill let you know how that went.
    We have our own web and database servers, so I can check the logs without problems.

  8. jacobvanpouderoijen
    Member
    Posted 8 months ago #

    I checked the following logs:

    • eventviewer on web and database server
    • WordPress log via define('WP_DEBUG_LOG', true);
    • IIS logs

    Eventviewer contained no errors or warnings related to the wordpress instance.
    The WordPress log contains one difference between loading a working page and the non-working one:
    PHP Notice: Undefined variable: term in <path>\wp-
    content\plugins\dynamic-widgets\dynwid_worker.php on line 520

    but disabling this plugin leads to a 404 on all my pages (even my custom 404-page, so I end up in an endless loop)

    For extra information these are the queries executed when I try to get the page, up till the point where I encounter a call to the 404-page.

    SELECT blog_id FROM wp_domain_mapping WHERE domain IN ('www.risk-direct.nl','risk-direct.nl') ORDER BY CHAR_LENGTH(domain) DESC LIMIT 1
    SELECT * FROM wp_blogs WHERE blog_id = '6' LIMIT 1
    SELECT * from wp_site WHERE id = '1' LIMIT 0,1
    SELECT blog_id FROM wp_blogs WHERE domain='risk-net.nl' AND path='/'
    SELECT meta_value FROM wp_sitemeta WHERE site_id = 1 AND meta_key = 'site_name'
    SELECT option_name, option_value FROM wp_6_options WHERE autoload = 'yes'
    SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'active_sitewide_plugins' AND site_id = 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'uninstall_plugins' LIMIT 1
    SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'ThreeWP_Broadcast_override_child_permalinks' AND site_id = 1
    SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'siteurl' AND site_id = 1
    SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'dm_no_primary_domain' AND site_id = 1
    SELECT domain FROM wp_domain_mapping WHERE blog_id = '6' AND active = 1 LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'dynwid_old_method' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'dynwid_page_limit' LIMIT 1
    SELECT t.*, tt.* FROM wp_6_terms AS t INNER JOIN wp_6_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('nav_menu')
    UPDATE <code>wp_6_options</code> SET <code>option_value</code> = '1' WHERE <code>option_name</code> = 'wordpress-https_ssl_host_diff'
    SELECT option_value FROM wp_6_options WHERE option_name = 'wordpress-https_secure_filter' LIMIT 1
    SELECT * FROM wp_users WHERE user_login = 'risk'
    SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (4)
    SELECT meta_value FROM wp_sitemeta WHERE meta_key = 'site_admins' AND site_id = 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_bcn_widget' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_fa-slideshow-widget' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_gnews-just-better' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_tweetblender' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_tweetblenderfortags' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_tweetblenderfavorites' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'widget_document_revisions_recently_revised_widget' LIMIT 1
    SELECT option_value FROM wp_6_options WHERE option_name = 'aiosp_post_title_format' LIMIT 1
    SHOW TABLES LIKE 'wp_6_dynamic_widgets'
    SELECT ID, post_name, post_parent FROM wp_6_posts WHERE post_name IN ('service','404-page-not-found') AND (post_type = 'page' OR post_type = 'attachment')
  9. jacobvanpouderoijen
    Member
    Posted 8 months ago #

    The problem creating the code is this piece of code in header.php:
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header middle') ) : ?><?php endif; ?>

    When I remove this it doesnt give the 404. I am not too familiar with this kind of if statements, but I assume it means that if either function_exists or dynamic_sidebar returns false it does not nothing.

    I checked the first part and the function exists. So the problem must be coming from the second part.

    I printed the global $wp_registered_sidebars and a sidebar by the name 'Header middle' is registered.
    I then continued checking into this function and it breaks after this piece of code: call_user_func_array($callback, $params);

    It turned out that there was a conflicting widget, and the website was built in such a way (for reasons unknown to me) that in cases like that it was automatically redirected to the 404-page. So it was a redirect instead of a 404.

    I hope this clarifies the steps taken to solve this problem, even though it is very case specific

Reply

You must log in to post.

About this Topic