Support » Plugins » Hacks » 302 ajax including wp-settings.php

  • Resolved bitxl


    I’m using ajax to run a script in a server with the purpose of retrieving some post information.

    I’m including WordPress in the regular way:

    define('WP_USE_THEMES', false);

    However, this gives a 302 moved temporarily as I can see in my console!

    If I prevent wp-settings.php from being included in wp-config.php it does get a regular response however I don’t have functionality without it… Does anyone know what this could be? Are there files in wp-settings.php that are included that could give such an error?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    Not sure it’ll make any difference, but try requiring wp-load.php instead of wp-blog-header.php. It is after all what all the core files do that need to do such things.

    Alternately, run your request through wp-admin/admin-ajax.php with an action: value as part of the request data. Then hook the appropriate action to execute your script.

    thanks for the reply!

    wp-load didn’t do what I wanted either, it somehow still lacked some functionality. Eventually I tried running the script from the wp-contents folder, not through ajax but a seperate file, turned out that some functions from the custom theme were declared twice and thus led to a php error, somehow WP made a 302 of that, still don’t know how 😉

    I finally got it working however by changing directory and commenting out the useless functions 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘302 ajax including wp-settings.php’ is closed to new replies.