Bootstrap file for setting the `ABSPATH` constant and loading the `wp-config.php` file. The `wp-config.php` file will then load the `wp-settings.php` file, which will then set up the WordPress environment.

learn more… | top users | synonyms

18
votes
5answers
30k views

What is the correct way to use wordpress functions outside wordpress files?

I read about 2 methods for initializing wordpress function outside of wordpress files so We can use these functions on any page or website outside the wordpress blog. Which one of these 2 methods is ...
11
votes
2answers
7k views

Initialize WordPress environment to use in command line script

I have a command line script for maintaining a wordpress plugin and have to load the wordpress core to be able to access wordpress functions. This problem is very similar to Initialize WordPress ...
8
votes
1answer
6k views

What is the very earliest action hook you can call?

After the solution to this question was to get a function to launch BEFORE the init action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load ...
5
votes
4answers
2k views

What is the best way to load the WP environment in a subdomain of my multisite Wordpress install?

I have a subfolder install of WP multisite, let's say at "domain.com". I now need to load the WP environment in subdomains of domain.com, say "sub1.domain.com", "sub2.domain.com", ... "subN.domain....
4
votes
2answers
3k views

Displaying content from one WP site on separate WP site

I have two totally separate WP websites setup. Different domains, different databases. I manage both of them and they are both hosted on a dedicated server. I am trying to include some basic ...
3
votes
4answers
2k views

Creating a Dynamic Path to wp-blog-header.php

Created a class in an external script which is dependent on the Wordpress environment. Since it's a class I intend to use on various projects, I decided to dynamically create a path to wp-blog-header....
2
votes
2answers
91 views

do_action and hook methods

I am trying to understand how hook methods work in WordPress. I understand that when do_action is called WP looks for all registered listeners and invokes them according to set priority. How does ...
2
votes
3answers
161 views

When is wp_loaded initiated only with admin or only when user enters the site or both?

When is wp_loaded initiated? Im trying to add function that downloads a big file for the plugin DB, and I need it to be executed whenever user/admin/unknown user get in the frontend, after the site ...
2
votes
3answers
2k views

update_option not working in stand-alone PHP script

I have a standalone PHP script in my WordPress theme's directory that I run once every hour through a cron job (or manually if needed). All other WordPress functions are working except the ...
2
votes
1answer
385 views

How to avoid wp-load.php within a PHP/CSS file?

This is tricky, as people usually mix wp-load with AJAX and I can't really find a proper answer. Case 1 I have a dynamic style.php file that looks like this: <?php header("Content-type: text/css"...
2
votes
1answer
268 views

How do you load WordPress from an external script when using MultiSite? [duplicate]

Possible Duplicate: Using WordPress functions on other sites I have an external script that needs to load up WordPress in order to have access to WordPress functionality. In the past I have ...
1
vote
3answers
3k views

How to load WordPress on non WP page?

I want to use the get_option() function of wordpress in one of my theme's files, which is not related to WP, it is just located in the same directory of the other theme files. I need this file because ...
1
vote
2answers
1k views

external wordpress pages using wp-blog-header

I am setting up a few sections of a website external to the core wordpress installation, but I still want to use the built in wpdb functions, and/or header files from wordpress. I follow the ...
1
vote
1answer
663 views

How to efficiently load and use the wordpress API from outside the original structure

I want to call Wordpress functions (the same ones we use to build a theme) from outside the original structure / folder / files of Wordpress. For example, in my theme folder I created a folder ...
1
vote
1answer
70 views

Include user defined styles without including wp-load

I've looked through the answers on here and none quite match my situation. I have custom CSS that a user can edit and it is saved in the options. I use wp_enqueue_style to include a PHP file with a ...
1
vote
1answer
6k views

Get current user data from external PHP page

I have a PHP page at the same level as the template/theme on WordPress. I need to be able to get the current logged in user details from this page. I have tried this: require_once( $_SERVER['...
1
vote
1answer
2k views

wp_enqueue_style with style.php and Wordpress functions

I use wp_enqueue_style to add my stylesheet, like this: <?php wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.php', false, '1.0', 'all' ); ?> It works fine BUT I need ...
1
vote
2answers
235 views

Create a post variable processing page

I need to create a blank PHP page that processes a POST request. Basically, a site will send me a few post variables. I need to use these variables with the mycred plugin. Here is my code: ...
1
vote
1answer
176 views

WordPress function gives different results outside vs inside PHPUnit test

I've been working very hard to get PHPUnit to play nice with WordPress (with the help of this, this, this, this, and this), and I think I've gotten pretty close. The code I run directly before my ...
1
vote
1answer
1k views

Is it possible to get post metadata of referring page?

I'm trying to direct a php authorization script to act if the page that referred to it belongs to a certain category (free). Is there something other than <?php wp_get_referer() ?> that will ...
1
vote
1answer
2k views

Include CSS with PHP without including wp-load?

I have a CSS-file generated from PHP. In my file it says... header("Content-type: text/css"); define('WP_USE_THEMES', false); include '../../../../wp-load.php'; I've read that including wp-load....
1
vote
2answers
2k views

Initialize WordPress environment to use in a real cron script

I have to run a PHP script through real cron (WP cron being too unreliable). Within that script, I need $wpdb to insert data into WordPress table. But of course $wpdb will not be available as ...
1
vote
2answers
206 views

Issue using wp-load.php in WordPress Plugin Development

Why it is bad to use this include("../../../wp-load.php"); ?? What is the proper way of use this?? Thanks
1
vote
1answer
111 views

Use wordpress functions in another PHP file

I have created in my theme folder a PHP file named gallery.php. In this file I want to use WP_Query function, but I can't do this because it shows error. Is possible to do this? Thanks in advance!
1
vote
0answers
156 views

Wordpress server change - slow admin login time for first time

I have a large Wordpress site. On local system we create a git repo for deploy a local version of Wordpress to DigitalOcean VPS servers. All Works great, but here is a problem to update a sql ...
1
vote
2answers
609 views

Load wordpress content in other domain

I've made some researches on google but can't get the right answer. I need to get my wordpress loops outside a domain using php file. For example: I have a website hosted with www.mysite.com using ...
1
vote
1answer
551 views

Access bloginfo, get_option, and plugins_url from a non-core php file

I am creating a plugin that has a php file in the plugin directory which is accessed directly via a custom rewrite url. I need this file to be able to use the three functions mentioned in the title. ...
0
votes
1answer
477 views

Trying to avoid including wp-load.php

I am working a plugin where I am trying to connect an HR system with WordPress. There is an XML API on the HR system so I have written the plugin to take the data and put it into a WordPress database ...
0
votes
3answers
5k views

Load Next WordPress Posts With AJAX?

I found an amazing plugin that loads the next posts with Ajax. http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax However it doesn't work with custom post types. The code ...
0
votes
1answer
349 views

WP_load, shortinit for wordpress Ajax

We have been using wp-load.php for ajax load. it's for showing a popup when you click "preview". As you may know it takes very long time (3~4 sec) for get even a few texts. We have searched and found ...
0
votes
1answer
51 views

Take control of WordPress before functions.php

I'm developing theme and I want to make page cache of static pages in my WordPress theme (and basically I know how to implement it) The problem is that when making theme - the first time when I "get ...
0
votes
2answers
163 views

Why does WP load so many files in the head of source code? How do I optimize it?

I have noticed that wordpress loads a bunch of files into the head of a site. This looks really sloppy and discloses vital information about the file structure of a website. Depending how many ...
0
votes
2answers
1k views

Use wp-load() and wp_head() to render a page's header outside of WordPress

I use wp-load() to load the basic WP environment and then read some info from the DB without any problem. But now i need to render the full header for a page, including the Yoast SEO plugin. After ...
0
votes
1answer
64 views

I need a standalone script in web root but still have access to the database

I am building a specialized xml output script (can't use the built in export) and I have a file in the web root that I can call from the URL domain.com/myscript.php. However, I need to be able to do ...
0
votes
1answer
220 views

Using wpdb without loading all plug-ins via wp-load.php

I'm trying to prevent WP from loading all plug-ins when including wp-load.php, since I don't really need them nor the usual WP actions/filters. All I need is the WPDB class to query the database ...
0
votes
1answer
508 views

Best way to load WordPress Bootstrap

My script needs to load the whole WP in order to work probably. I'm currently doing it this way if ( !defined('ABSPATH') ) { /** Load WordPress Bootstrap */ @ini_set('include_path', '../../.....
0
votes
1answer
205 views

External PHP file & Pretty Permalink

I'm working in developing REST API for a WP based website. Endpoint is http://example.com/api.php I've included wp-load.php in the top of the file to access WP functions etc. However, http://example....
0
votes
1answer
182 views

Admin first hook that outputs HTML?

I think load-(page) is the first hook in the admin screen that deals with outputting HTML, but I'm not totally sure. Basically I'm looking for the equivalent to template_rediect or get_header, which ...
0
votes
4answers
1k views

How to load wordpress environment without loading the template?

Basically I want to use wordpress functions for example wp_create_user() or wp_update_user() outside of wordpress (outside of wordpress directory). I tried with all the below code snippets to load ...
0
votes
1answer
171 views

WordPress and IPN problem

I have created a file in my template folder called ipn.php: <?php $req = 'cmd=_notify-validate'; foreach($_POST as $key => $value) : $value = urlencode(stripslashes($value)); $req .= "&...
0
votes
2answers
568 views

PHP mobile redirect Endless loop

I have a mobile version I'm building outside of Wordpress in a subfolder on the same server as my Wordpress install. I'm including the wp-load.php file to pull content from the WordPress database. If ...
0
votes
1answer
242 views

wp-load.php redeclares classes

I am trying to load WordPress options within a standalone PHP file. The file is located in /wp-content/plugins/plugin-name/file.php. I have used the following to open wp-load.php: if (file_exists('../...
0
votes
2answers
1k views

Including 'wp-load.php' after another include() generates an error

I know all the downsides of trying to include wp-load.php, but bear with me :) I'm trying to create my own admin-ajax-like functionality, in a way that I can control whether or not I load the default ...
0
votes
1answer
938 views

Loading wp-load.php in an external PHP file throws unknown error

I'm loading wp-load.php in order to access WP functions inside of a PHP file that I'm using to process form submissions. Everything works perfectly fine on localhost and every server I've tested (...
0
votes
1answer
414 views

Subdomain redirect problem

Wordpress is installed my root directory(/root/). I have a subdomain(dammani.techbrij.com) and I want to access some files of main domain from sub domain. I have done following thing: include_once('/...
0
votes
0answers
17 views

External php application - get_current_user_id() return 0

I have an external php application. I want to get current WP user id who is logged on but function get_current_user_id() always return 0. For connect my external php application with WP I use this ...
0
votes
1answer
33 views

How to avoid loading wp-load.php from external php scripts?

i use slim with wordpress. This worked flawlessly so far. Well almost. Once I changed to multisite I had to start fake creating $_SERVER variables faking a domain name. But it worked finally. What I ...
0
votes
1answer
50 views

Looking for a better way to handle an ajax script that pulls in post data on click

I've developed a template page that displays a grid of "employees" (a custom post type). That part works fine, but I also needed to set up a lightbox to display additional details on click. To avoid ...
0
votes
0answers
32 views

WordPress Outside of WordPress Not Executing

When visiting hello.php in the browser, it works just fine; however, when executed via command line, php5 /var/project1/hello.php, nothing happens. hello.php contains only the following code: <?...
0
votes
0answers
26 views

Using WordPress User Details outside Directory

I have a PHP Web App in which I want to use some User Details from WordPress installed inside a Folder. Suppose My App will be inside ===>>> www.example.com and my WordPress install will be inside ===...