Using plugin functionality in external php script not working

I am encountering a strange problem which I couldn't solve so far. I'm calling a .php script via cronjob (Debian/GNU Linux). To use wordpress functionailty I added: define('WP_USE_THEMES', false); require( '/full/path/to/wp-blog-header.php' ); Now database queries and default wordpress functionality all works fine, but I also call some functions provided by a plugin (namely advanced custom fields, the problem however affects other plugins as well as I tested) the following php error is returned: PHP Fatal error: Call to undefined function …
Category: Web

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 the correct one? What are the use cases for each method if both are correct? What is the deference between using one method or the other? Method 1: <?php define('WP_USE_THEMES', false); require('./wp-blog-header.php'); ?> Method 2: <?php define('WP_USE_THEMES', false); require('./wp-load.php'); ?>
Category: Web

Body tag in header AND template/footer?

So I'm pretty new at Wordpress development, and I'm a little confused by one thing. After going through and finishing my navigation in my header.php file, I went over to my template for the home page I'm working on. My question is: since the "body" tag is the only place you can write that actually shows up in the browser ("header" tags are for meta data etc), can I have more than one body tag? I read a little into …
Category: Web

Fatal error: Uncaught Error: Call to undefined function wp()

I keep getting the below message and I can't access my website: Fatal error: Uncaught Error: Call to undefined function wp() in /home/q77bvndhxly7/public_html/wp-blog-header.php:16 Stack trace: #0 /home/q77bvndhxly7/public_html/index.php(17): require() #1 {main} thrown in /home/q77bvndhxly7/public_html/wp-blog-header.php on line 16
Category: Web

Using wordpress and codeigniter in one website

Is it possible to use WordPress as the CMS but all of contents will be displayed using CodeIgniter? What I want to know also if I can use the WordPress functions by simply including this wp-blog-header.php in the CodeIgniter. Do you guys think this idea will work? Probably one of the function I really need is apply_filters()
Category: Web

Call to undefined function wp() in wp-blog-header.php

I am getting this error: Fatal error: Uncaught Error: Call to undefined function wp() in /home/pgcimykfka2h/public_html/apni-rasoi.com/wp-blog-header.php:16 Stack trace: #0 /home/pgcimykfka2h/public_html/apni-rasoi.com/index.php(24): require() #1 {main} thrown in /home/pgcimykfka2h/public_html/apni-rasoi.com/wp-blog-header.php on line 16
Category: Web

include multiple wp-blog-header.php from different blogs

I want to include more than one wp-blog-header.php like the following. $config = array( array( "path" => "/path/to/blog/1/" ), array( "path" => "/path/to/blog/2/" ) ); foreach($config as $site){ include($site['path']."wp-blog-header.php"); echo get_site_url().' '.$site['path'].'<br>'; } I get echo out the first site_url 2 times. So i believe there wordpress doesn't connect to second blog. Is there a way to reset connection and everything which was included?
Category: Web

How to run a function after wp() in the wp-blog-header.php file?

I want to run a function after the wp(); line in the file wp-blog-header.php, what is the proper hook to use here? <?php /** * Loads the WordPress environment and template. * * @package WordPress */ if ( !isset($wp_did_header) ) { $wp_did_header = true; // Load the WordPress library. require_once( dirname(__FILE__) . '/wp-load.php' ); // Set up the WordPress query. wp(); /******************************************** I WANT TO RUN THE FUNCTION AT THIS POINT ********************************************/ // Load the theme template. require_once( ABSPATH . …
Category: Web

how to add H1 in title site?

based on SEO inspector said that my homepage doesnt cointain H1 heading... this code from developer source i taken from mozilla browser <title>interiordapur - Ahlinya Kitchen Set & Desain Interior</title> I check source my website no H1 detected. and I check my theme header.php that the code such below <?php /** * Setting global variables for all theme options saved values * * @since Construction Field 1.0.0 * * @param null * @return void * */ if ( ! function_exists( …
Category: Web

My first web wp-blog-header.phd

This is my first time making af webside and I have by an accident deleted somthing in/ at my File manager. (I thougth it was the blog part that i do not need ) but Now the webside is white and it calls for this: wp-blog-header.php I can see that wp-blog-header.php have 0 KB now, how do i repear? and find the file again? PLS help me I'm autodidak Can i rescue the page?
Category: Web

How to select a specific page

I'm having an issue selecting a page. There are guides that tell you how to find the page ID and I just couldn't find it in the admin panel to figure out what the page ID is. If only there was a way to search by slug in the admin panel that would be great. the other way was to look at the elements which worked beautifully for me. I used that and that worked great! $classes = get_body_class(); if …
Category: Web

Plugin alternative to wp-blog-header.php hacks?

I have 2 extra pieces of code in wp-blog-header.php. The first handles 410 and 404 headers and goes at the top, before the line if ( !isset($wp_did_header) ) { The second handles some complex redirects and goes after the wp(); line. I know it's a bad idea to hack core WP scripts (especially as my hacks get overwritten on most WP updates). I'd like to do both as plugins, but I can't figure out which hooks to use, nor how. …
Category: Web

Add custom field information to source meta data

I try to add information from a custom field into the metadata in the source code. While searching for the solutions I found some. As I am not really an expert I ask you guys. I want to add information for a Digital Object Identifier (DOI) from a custom field to the source code so that the Search Engine of Altmetrics can find it. Necessary meta tags are: Identifier (e.g. citation_doi) Title (e.g. citation_title) Author (e.g. citation_author) ISSN - if …
Category: Web

How to call WordPress PHP file using external js file

I have added custom PHP file in WordPress directory and added following line to use WordPress functions: require ('../wp-blog-header.php'); Now I am able to use WordPress functions but unable call this file from javascript in ajax. When I removed following line then I am able to call this file: require ('../wp-blog-header.php'); Please suggest how can I solve this issue.
Category: Web

Blog page is not showing properly

I am working on my site http://coregroupus.com/blog/ due to some problem my blog page is not displaying posts properly. Its showing the content of some other page in header, however all the posts are okay, like if we see them here http://coregroupus.com/reducing-taxable-income/ http://coregroupus.com/profit-sharing-plans/ Please help me to get this issue fixed. Thanks
Category: Web

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 the wordpress environment, I am able to use the functions correctly in both the cases but the problem is that this also loads the wordpress template which I do not want. First Method: <?php define('WP_USE_THEMES', false); require ('../blog/wp-load.php'); ?> Second Method: <?php define('WP_USE_THEMES', false); require ('../blog/wp-blog-header.php'); ?> Directory Structure: /blog | …
Category: Web

How to extract some part of WordPress full source code

Is it possible to extract some part of WordPress like the posting and display of content. In the posting part all the processes used in posting and updating a content or the posts. Ihe index process I mean an easy way to view content from the database without going to many process which the website those. For instance www.example.com/wordpress/index.php should have the power to go direct to the database and get information of the posted content and display it not …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.