The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
61 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
50 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
53 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
26 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
0answers
12 views

Using Customizer value outside WordPress

I'm working on a theme which uses a custom PHP script for contact form. The jQuery sends the form data to the script and the script sends the email. There are some parts of the scripts that should be ...
1
vote
0answers
62 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
73 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
50 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
123 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
0answers
78 views

path-based multisite: Including wp-load.php in external page redirects page to blog

I have a multisite setup at foo.com/school/blog. Now when I try to include wp-load.php on bar.com it redirects the page to foo.com/school/blog. bar.com is an ad on domain and points to foo.com/test. ...
0
votes
1answer
61 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, ...
0
votes
1answer
70 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 ...
0
votes
1answer
84 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
0answers
62 views

Using Wordpress functions in custom PHP file without any output to the page?

I need to use Wordpress functions get_option and update_option in a custom PHP file. However, I also need to be able to redirect using headers at the end of the PHP script. Requiring wp-load.php or ...
0
votes
1answer
41 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
138 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: ...
0
votes
0answers
98 views

Custom Plugin inlcude wp-load.php in my new.php file

I have created a custom plugin in WordPress and uploaded to the WordPress.org But the plugin is rejected due to I was including require_once("../../../../wp-load.php"); In one of my php file which ...
0
votes
0answers
20 views

check_admin_referer always false when I use on add_action('load-'* hook

I have try to add hook on load my plugin page. But every time i save my config, it always return "Are you sure want to ..." message. Is there something i missed? Here's my code: <?php class ...
1
vote
1answer
100 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
96 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
273 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: ...
0
votes
0answers
150 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
370 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 ...
0
votes
1answer
382 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 ...
-3
votes
1answer
81 views

content of the page is not displaying getting empty page [closed]

<body> <div id="wrapper"> <h2>1stWebDesigner PHP Template</h2> <ul> <?php wp_list_pages('title_li=');?> </ul> </div> <!-- end #nav --> ...
0
votes
0answers
209 views

Why I have this error when I try to install this old blog on my local webserver?

I am pretty new to WP (I came from Joomla) and I am finding some difficulties trying to put on my local web server an old backup of a website (made using WP 3.5) I have performed the following ...
-1
votes
2answers
35 views

Sessions in word press [duplicate]

Is it possible to set session in wordpress. If yes can you please tell how to do it? My sample code is. <?php session_start(); if(!isset($_SESSION['impression'])) { $_SESSION['impression'] = ...
0
votes
3answers
553 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
293 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
1answer
351 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
64 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 ...
2
votes
3answers
849 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 ...
0
votes
1answer
541 views

Frontend file upload works, but I get error “Constant ABSPATH already defined”

I am uploading files from the frontend. It works perfectly, yet I am getting the error: Constant ABSPATH already defined This is at the top of my file upload script: require ...
0
votes
1answer
103 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
0answers
212 views

To call hook on a php external file

I can't to call the a filter hook on a php external file of wordpress. This is my code - my_external_file.php -: <?php require( dirname(__FILE__) . '/../../../../../../../wp-load.php'); ...
0
votes
2answers
466 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 ...
1
vote
1answer
82 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!
0
votes
2answers
481 views

wordpress login blank screen [closed]

i wanted to make an offline copy of my live website on my pc so i installed xamp and installed on it wordpress and exported the database and took a copy of files on fttp and after i have done ...
0
votes
1answer
154 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 ...
0
votes
1answer
93 views

Get Core Functionality from Within a (Secondary) Plugin File

I have a plugin with the following structure: myplugin.php includes/authentication.php I can access core WordPress functionality inside myplugin.php fine, but when I try to access stuff such as ...
0
votes
1answer
141 views

Wordpress repository forbids me call wp-load.php in non-WordPress file

I have made a Wordpress Plugin that is a kind of Download Manager. I have a external file download.php that is responsible for making downloads. This file is away of environment Wordpress, for this ...
10
votes
2answers
3k 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 ...
0
votes
3answers
2k 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 ...
-2
votes
1answer
965 views

Use ajax response in PHP function

Ok, so I'm working on a plugin and just ran into a problem. Here's what I'm doing: 1. Using a metabox with Plupload to upload an image to an upload dir in the plugin folder. 2. Upon upload success a ...
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 ...
0
votes
2answers
843 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
163 views

What is Global Wordpress Objects?

I was trying to load wordpress in a smarty template and i have got a lot of errors that has the same origin "Fatal error: Call to a member function the_function() on a non-object". The solution to ...
1
vote
1answer
497 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. ...
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 ...
9
votes
2answers
16k 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 ...