Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9193003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:03:39+00:00 2026-06-17T21:03:39+00:00

I am developing a WP Plugin. Currently, I am making an ajax call with

  • 0

I am developing a WP Plugin.

Currently, I am making an ajax call with jquery to a standalone php file in my plugin folder.
Let’s presume that this file is called test.php.

The file is NOT loaded prior to this call, so no native wordpress functions work in this file.

As a result, I have require_once('wp.load'); in test.php.

Here stems my questions:

  1. The only function I need from wordpress is $wpdb->insert. Is there a better function to include than wp-load? Something that doesn’t include so much, since all I need is this one function!

  2. I understand that require_once loads the file, ONLY if it hasn’t been loaded yet. Maybe I’m overlooking the situation, but how does this work with ajax? If there is a “success” response, does test.php close, thus when its called again, it loads wp-load.php again?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:03:40+00:00Added an answer on June 17, 2026 at 9:03 pm

    If there is a “success” response, does test.php close, thus when its
    called again, it loads wp-load.php again?

    Exactly. The concept behind require_once (or include_once) is to make sure you don’t reload the same functions, classes & variables into the same currently running PHP code at the same time:

    include_once may be used in cases where the same file might be
    included and evaluated more than once during a particular execution of
    a script, so in this case it may help avoid problems such as function
    redefinitions, variable value reassignments, etc.

    And since PHP scripts run only on request, what you describe is exactly how it would happen.

    That said, I wouldn’t over-think the concept of loading the whole wp.load each time it’s needed. I doubt it will cause such a performance hit that it would even be noticeable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing a site that users the jQuery superfish plugin to construct
I am currently developing a rather complex jQuery plugin. One that I am designing
I am developing a Phonegap plugin. My HTML file looks like this: <!DOCTYPE HTML>
I'm currently developing an eclipse plugin. This plugin contains a project nature which depends
I'm currently developing a firefox plugin. This plugin has to handle very crappy website
I'm currently developing a jQuery Plugin called Sudo Slider. ( http://webbies.dk/SudoSlider/ ) While developing
I'm currently developing an IE plugin using SpicIE . This plugin does some web
I am currently developing a plugin for eclipse that analyzes dependencies and references between
I am currently developing a jQuery plugin where I would like to dismiss an
I'm developing this app which as a very basic Ajax form and I'm currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.