Integrating WordPress into my site: Global blues and many non-objects
-
Hello everyone
I’ve been developing and coding sites for over 20 years and this is the first time I’m ingetraging WordPress to an existing site of mine. Installation went well.
But now I’m having two issues when the real integration begins:
a) Global variables aren’t initialised
b) Null pointer in handle_404 (non-object)a) Global variables aren’t initialised
Inside index.php I have this:// Load some other application stuff require 'core.php'; // Then integrate WP define('WP_USE_THEMES', false); define('WP_DIR', WEB_ROOT . DIRECTORY_SEPARATOR . 'wordpress'); require(WP_DIR . DIRECTORY_SEPARATOR . 'wp-blog-header.php'); ...
Like that the first error is:
Fatal error: Call to a member function main() on a non-object in /[REMOVED]/httpdocs/wordpress/wp-includes/functions.php on line 1570I have to add this line before the integration to make this error disappear:
global $wp, $wp_rewrite, $wp_the_query;
In my opinion it’s not nice and bad code. Is there no other way around? Any better solutions?
b) Null pointer in handle_404 (non-object)
Depsite of my quick and dirty solution (above) I encouter another `error:
MESSAGE: Trying to get property of non-object
TYPE: Notice
FILE: /[REMOVED]/httpdocs/wordpress/wp-includes/class-wp.php
LINE: 477`After some debugging I can see $wp_query on line 477 is NULL.
I do not want to hack WP otherwise any further updates will make it instable again. Are there any solutions out there?
Thanks for your help!
Cheers,
Michael
- The topic ‘Integrating WordPress into my site: Global blues and many non-objects’ is closed to new replies.