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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?

My requirement is to create a survey in wordpress, and the user needs to log in before answering. But the login page uses our own business account, so we created a login page ourselves (using .net ...
0 votes
0 answers
42 views

Hook from plugin doesn't fire up from external PHP script

I have this habit of installing a plugin with all my custom hooks, instead of writing a functions.php file with the same PHP code in it. That way I get the same functionality without the need of ...
  • 123
0 votes
0 answers
18 views

I created a plugin with 'view page' that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML

I created a custom plugin. The plugin has a view log page. Here is my viewpage_template.php. First part is a query. The second part is a PHP for loop to present the data in a table. <?php // ...
0 votes
0 answers
17 views

Wordpress custom php script to match standard page layout

I am writing a custom php script and want to load the theme so it will look like a regular page. I tried the following. <?php define( 'WP_USE_THEMES', true ); require( $_SERVER['DOCUMENT_ROOT'] . '/...
  • 183
0 votes
0 answers
22 views

how to define a html folder to make it work with WordPress commands

so is it possible to define a folder outside the wp-$folders ? i created a html page and i want to use WordPress hooks and filters in it simply the WordPress PHP syntax im still learning php - and i ...
  • 1
1 vote
1 answer
28 views

Open Post Thumbnail in New Child Theme File in Wordpress

Today I am stuck in a new problem using WordPress Theme Development. What I'm going to do is to open a Thumbnail image in a new separate child theme, when the user clicks on the anchor tag. Example: ...
1 vote
0 answers
222 views

how to upload a image from frontend with wp_insert_post and also update_post_meta?

I am using cmb2 for frontend form submission with custom post type name 'form'. But can not upload image with that. the first step is: array( 'name' => 'Image', 'type' =&...
1 vote
1 answer
240 views

Check user logged in from outside of WP folder

If user is logged in to site/subsite, and you check this function: require(__DIR__."/wp-load.php"); var_dump(is_user_logged_in()); it returns true. However, if called from outside folder: ...
  • 5,371
0 votes
1 answer
773 views

Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin

I created a plugin TESTPLUGIN and added it on wordpress admin menu. I can access the plugin from the admin menu just well. The problem I am having is how to link to another file within the plugin. The ...
  • 101
0 votes
1 answer
465 views

WordPress Nexus Theme front-end editor broken because cannot find wp-load.php [closed]

I’ve got a Nexus Theme (https://nexusthemes.com/) that stopped allowing me to edit through the frontend. Gives an “Error transferring data. Please try again later.” Console reports “Could not find wp-...
0 votes
0 answers
234 views

Doesn’t call user information to include “wp-load.php” in an external php file

Doesn't call user information to include "wp-load.php" in an external php file. <?php require_once( dirname( dirname( __ FILE __ ) ) . '/wp-load.php' ); global $wpdb, $user_ID; echo $user_ID; // ...
  • 290
1 vote
0 answers
151 views

How to access $menu variable in custom .PHP file that loads wp-load.php?

I have a file custom.php inside the WP root folder. My goal is to access the GLOBAL $menu variable that stores the admin menu items. In order to do that, I try loading the WordPress environment. <?...
  • 11
1 vote
1 answer
2k views

wp-load.php not working

I'm using require_once(../../../../wp-load.php), which is the correct relative path to the file, but it doesn't work. If I use wp-blog-header.php instead, that works and enables me to use WP functions....
3 votes
2 answers
3k views

Problem accessing wp-load.php

I'm writing a standalone script for Wordpress so I can display things like the username on a page outside of Wordpress. My method so far is to try to include or require wp-load.php in my script ...
-1 votes
1 answer
2k views

How to include wp-load.php and have all plugins load as well

Why load wp-load.php 'use wordpress ajax instead' no This is for testing only. I have a test page I use for local development only, e.g. test.php in my themes folder Now when I do this: global $...
  • 504
1 vote
0 answers
78 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
2 answers
308 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
0 answers
47 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(...'/...
  • 5,371
1 vote
0 answers
905 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 ...
  • 221
0 votes
1 answer
96 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 ...
1 vote
1 answer
2k 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 ...
  • 139
0 votes
1 answer
6k 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 ...
's user avatar
0 votes
2 answers
222 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 ...
  • 19
0 votes
1 answer
106 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
1 answer
142 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 ...
  • 3
0 votes
1 answer
13k 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'); ...
  • 113
1 vote
0 answers
233 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 ...
  • 111
0 votes
1 answer
817 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
0 answers
251 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). ...
5 votes
1 answer
9k 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
1 answer
2k 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 ...
4 votes
4 answers
7k 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 ...
  • 161
1 vote
1 answer
1k 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 ...
  • 504
2 votes
2 answers
2k 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 ...
  • 131
-1 votes
1 answer
391 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 ...
  • 113
0 votes
1 answer
438 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 ...
  • 23
5 votes
3 answers
9k 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 ...
  • 781
0 votes
2 answers
252 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
1 answer
105 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 ...
  • 101
0 votes
2 answers
8k 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 ...
  • 459
0 votes
1 answer
2k 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 ...
  • 683
1 vote
2 answers
812 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
  • 397
0 votes
1 answer
122 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 ...
  • 45
1 vote
0 answers
660 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 ...
  • 131
0 votes
2 answers
771 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 ...
  • 692
0 votes
0 answers
255 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 ...
  • 11
1 vote
1 answer
2k 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', '../../.....
  • 969
0 votes
1 answer
482 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
1 answer
250 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 ...
  • 692
2 votes
1 answer
1k 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 ...
  • 4,239