Forums

wp-phpMyAdmin gives 404 after template_redirect (3 posts)

  1. steven_desu
    Member
    Posted 1 year ago #

    I'm very new to modifying WordPress, so please explain things in great detail (I've seen a large number of posts which simply contain PHP code, but they never say which file this code should be in, for instance, or how this code is called by WordPress)

    I tried to install the wp-phpMyAdmin plugin for WordPress, however whenever I try to run an SQL query I get redirected to a 404 page. I've stepped through the code to try and determine exactly when I am changing from phpMyAdmin to the 404 error and I have discovered that up until template_loader.php everything seems to be running well. After template_loader.php is called (and before the include($template) line) the variable $template is pointing to a 404 page.

    Reading through as much code as I could, I've determined that do_action('template_redirect') is changing $wp_query->is_404 to true. Although I have been unable to figure out exactly what template_redirect does to figure out why this is happening. The WordPress Codex merely says:

    template_redirect
    Runs before the determination of the template file to be used to display the requested page.

    And you can't even click on template_redirect to figure out where this action is getting linked to a function. Any help would be appreciated.

  2. steven_desu
    Member
    Posted 1 year ago #

    Was my topic moved? I could have sworn I posted this in the How-to and Troubleshooting section.

    I would definitely consider this troubleshooting and not "plugins and hacks". My issue is with the template_redirect function, a core feature of WordPress. The plugin itself functions perfectly, but WordPress is not redirecting my pages properly.

    [Moved to How-to & Troubleshooting]

  3. steven_desu
    Member
    Posted 1 year ago #

    Thank you. Also, I did a little bit more research on the subject. I noticed that the request was okay until it reached template_loader.php (hence my original assumption of the issue being template_redirect)

    I have found that it's actually the wp() function which is causing the is_404() function to return true. Upon looking through more code I found that wp() is just calling $wp->main(), which is in turn calling $wp->parse_request()

    The parse_request() function is very long and seems to take a lot of parameters from $wp_rewrite. I want to modify WordPress core as little as possible (I mean - I could easily just put a line in parse_request saying "If the requested URI is ... then return without doing anything) so how can I take advantage of $wp_rewrite to fix these 404 errors?

Topic Closed

This topic has been closed to new replies.

About this Topic