WordPress.org

Ready to get started?Download WordPress

Forums

Speeding up Ajax Calls (4 posts)

  1. narix
    Member
    Posted 2 years ago #

    Hi there,
    I want give my ajax calls a little more Speed.

    If i run my callbacks via addaction("wp_ajax_someslowfunction") and the ajaxurl i got a response time about 1.5 seconds on my small developing mashine.
    So i decide to call a file in my plugin directly. Thats pretty fast but I need a least the wpdb Object. And to use it i have to include the wp_config.php. But these include the wp_settings and the whole big
    system.

    Why is there no possibility to include just the config and the dbclass?

    My only idea is to put the db settings in a session. But this is not so sweet and secure.

    What u think about it?

  2. shazdeh
    Member
    Posted 2 years ago #

    Don't you need reading database, access something, use Template Tags or whatever? Don't you need to load the WP?

  3. Anders
    Member
    Posted 2 years ago #

    You do need to load WP, and in my experience at the level admin ajax is executed there isn't much of a load on the WP system.

    I think the only way to make it faster would be to use some sort of caching. Obviously I have no idea of what sort of function you're doing, but if you're querying data you could load all the needed data into a JS var/array and then simply run "queries" against the array.

  4. jamielob
    Member
    Posted 2 years ago #

    Old post but in case anyone else is looking for the answer for how to load just the database functions (wpdb) of WordPress take a look at the bottom of my post here:

    http://www.beautifulcoding.com/snippets/176/using-wordpress-funcitons-outside-of-wordpress/

Topic Closed

This topic has been closed to new replies.

About this Topic