The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Wrong $wpdb->prefix value after AJAX request (2 posts)

  1. supertester
    Posted 3 years ago #


    I am using the following piece of code in a file that handles a AJAX request. I know this is not the way WordPress AJAX works, but this way is about 10x faster.

    ### Define and Include
    define( 'SHORTINIT', true );
    //define( 'WP_USE_THEMES', false);
    include_once '../../../../wp-load.php';
    global $wpdb;
    	echo $wpdb->prefix;

    I never had any problems with this piece of code. But now I am firing an AJAX request from a category page, and the $wpdb->prefix value = 'wp_', which it should not be! How on earth is this possible?

  2. supertester
    Posted 3 years ago #

    It was including the wrong wp-load.php, I guess not coding the wordpress way got the better of me!

Topic Closed

This topic has been closed to new replies.

About this Topic