Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [wp-load.php]

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.

0
votes
0answers
25 views

Cron job cannot use “wp_remote_post”

I've written a script that is running once an hour on my site but it's not working. I've been trying to debug and unfortunately I haven't gotten very far. I'm getting the following error: Uncaught ...
0
votes
0answers
45 views

Custom endpoint without loading entire Wordpress

With only WooCommerce installed the Wordpress rest api loading time is above 1.5s, this is unpractical, so i'm trying to create a custom endpoint and define SHORTINIT to true to load the minimum ...
0
votes
0answers
21 views

Trying to fix plugin when WP plugins directory moved

I am trying to fix the plugin "Magic Post Thumbnail". I have fixed several issues related to PHP warnings, spelling, and bad grammar, but I am having a little difficulty getting it to run when the wp-...
0
votes
0answers
132 views

Cannot add posts via wp_insert_post(). Gets database error

I am trying to add a post via an external file, but I keep getting an error: WP_Error Object ( [errors] => Array ( [db_insert_error] => Array ( [0] => Could not insert post into the database ...
1
vote
0answers
40 views

getting logged in user info (wp-load.php) from parent directory

Directory structure: https://www.example.com/test.php https://www.example.com/blog/wp-load.php test.php: require_once("blog/wp-load.php"); global $current_user; get_currentuserinfo(); print_r($...
0
votes
2answers
29 views

WP CLI can't delete plugin related table

I have installed a plugin following wp plugin install ... CLI command and then activate through CLI command its working properly. But problem is that when I deactivate then delete the plugin the table ...
0
votes
0answers
31 views

Which position is after `wp-load.php`?

i.e. instead of this code: include_once(...'/wp-load.php'); add_action('init', 'my'); function my(){ if(current_user_can('manage_options')){ ..... } } we can simply use: include_once(...'/...
0
votes
0answers
196 views

Cron job script - loading wordpress system fails

I want to run a cron job that fetches data from an api and stores it in a database table. I don't use "wp-cron". I load a script in a folder inside the theme. But I need to load the wordpress system ...
0
votes
1answer
32 views

Fetching latest posts from 2 different WP installations

I have three WordPress installations (cannot use multisite; cannot use RSS/Atom feeds) and I am trying to display a date-sorted list of the latest 10 posts from each of the two sub-sites on the main ...
0
votes
1answer
494 views

wp-load Without Loading the plugins

I am building a 'control panel', for my server and would like to use my Wordpress userbase to control the login functionality, as well as be able to show some posts. I have set some defines and ...
0
votes
1answer
1k views

How can I call wp-load.php in my plugin file

I need to call wp-load.php in my plugins file but in case if I call it directly the plugin is not being accepted for wordpress repository and we are been given issue. So please guide me how can we ...
0
votes
2answers
131 views

How to get option values without requiring wp-load?

I am developing theme to sell on themefores. I want to get option values in the head. but as the checkoptions would not be called yet i need to call wp-load.php. but the reviewer from themeforest ...
0
votes
1answer
52 views

What hook is the currently active theme's functions.php file loaded on? [duplicate]

At which point of hook execution is the currently activated theme's functions.php file loaded?
0
votes
0answers
269 views

How to get post thumbnail in snippet loaded on non-WP page?

I'm trying to implement something on a non-Wordpress PHP page outside the WP directory that shows the most recent WP post with the title, excerpt, and featured image as a thumbnail. Right now the off-...
0
votes
0answers
15 views

Changes doesn't reflects in UI and showing a non-existent array which printed earlier

I had created php file in wordpress root directory and i am using wordpress functions by including "wp-load.php" Using WP_Query i had print array of data but somehow after printing an array other ...
0
votes
0answers
267 views

RAM exhausted: class-wp-query

Actual I am writing a script for my own. This script is dealing with products and should delete posts on my WordPress site if they are not in the database anymore. So I iterate though my hole database ...
0
votes
1answer
52 views

<link rel=“icon” href=“”> Causing my Wordpress functions to execute twice

As my title says, today I spent more than 5 hours figuring out why when I tried to add a new activity to buddypress (via bp_activity_add) It would be added twice or even three times. I started ...
0
votes
1answer
3k views

Proper way to use WordPress function with AJAX PHP file

I have the following jQuery function in my custom-js.js file: $(function() { $(".product-vote-button-up").click(function(){ var productID = $(this).attr('productID'); ...
1
vote
0answers
161 views

Programmatically inserting post through URL - when including wp-load.php, it's redirecting to wp-admin/install.php

I am trying to insert a post programmatically. A file is placed in the same directory where WordPress is installed. When I try to include wp-load.php, it is redirecting to wp-admin/install.php and ...
0
votes
1answer
377 views

Error establishing a database connection - after updating DNS

I have created website on my server, and i have bought hosting from a company and then I updated the DNS IP, after that when i try to open this website it opened fine but sometimes it gives me this ...
0
votes
0answers
187 views

Exploiting WordPress Core Functionality for Development

As WordPress is one of the Most Popular platform for the development, I searched and read 100s of articles to understand that if I can harness the power of wordpress (Like its security and db class). ...
3
votes
1answer
4k views

WP-Admin not working properly at Wordpress multisite with subdirectories

I have recently installed a Wordpress Multisite Blog on my domain. Everything is working fine, except for wp-admin of the subsites: I can access wp-admin of a subsite, but css is not loaded and when ...
1
vote
1answer
775 views

Accessing the database from a plugin outside of action hooks

I am working on a plugin that provides an endpoint for handling OAuth2 authorization against a remote server, on successful authorization stores some information from that server in the Wordpress ...
2
votes
1answer
2k views

Notice: map_meta_cap was called incorrectly

I created an external script to import json data into a custom post type that uses wp-load.php. Everything works fine but after every update I get the message Notice: map_meta_cap was called ...
1
vote
1answer
662 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 ...
2
votes
2answers
839 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
1answer
205 views

how to use header function in wp-load.php file [closed]

I am making a file that is used for downloading files that are stored in my website. But when I try to download the file on clicking a button, it does not load the file. I am using header function to ...
0
votes
1answer
267 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 ...
2
votes
3answers
2k 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 ...
0
votes
2answers
125 views

Retrieve data from multiple Wordpress sites using PHP script

I want to run a PHP script that iterates over WordPress sites found in a certain folder and read the plugins info per each site using get_plugin function In the code below, I try to require API ...
0
votes
1answer
84 views

Rewritten URL not loading WordPress environment

I have a page that I am sending users directly to so I can serve them a PDF dynamically created using the FPDF library. Since I'm sending them directly to the file which generates the PDF, I'm ...
0
votes
2answers
5k 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
1k 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 ...
1
vote
2answers
511 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
0
votes
1answer
95 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 ...
1
vote
0answers
448 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 ...
0
votes
1answer
428 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
0answers
153 views

What is the best practice to initialise $wpdb by loading wp-load.php?

Why do users with high reputations suggest loading wp-load.php with a full path? My question is simple and was originally intended as an answer to this question. However I do not have a high enough ...
0
votes
1answer
1k 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
295 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
172 views

Manually cache a special, non-WP-but-using-WP page (e.g. Ajax results) with W3TC

Under the active theme folder, I have a search-autocomplete.php file which uses various WP queries to create smart JSON results delivered via AJAX to a jQuery UI Autocomplete input field. It's not a ...
1
vote
1answer
477 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
1answer
57 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 ...
1
vote
2answers
620 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: ...
2
votes
1answer
279 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 ...
0
votes
1answer
248 views

Using actions, hooks and filters in a non-WordPress page

I have a php script that sits outside of wordpress, but loads WP core with wp-load.php. Here is my basic page: <?php define('WP_USE_THEMES', false); global $wp, $wp_query, $wp_the_query, $...
2
votes
1answer
486 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"...
0
votes
0answers
266 views

Get wp-load.php PATH with wp_localize_script and JavaScript for plugin

I just learned about wp_localize_script() and it's very cool. I read Otto's post and Gary Cao's post, but I'm learning Ajax so I'm trying to wrap my head around getting the path to wp-load.php this ...
1
vote
2answers
1k 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 ...
4
votes
1answer
2k 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 ...