Saturday, 5 December 2015

How do I get wordpress global variable and functions in custom file

if your custom file is at WP blog root folder.
Just add the following line in top. This will load wordpress blog and you can access global variables.

require( 'wp-load.php' );
global $wp_query;

No comments:

Post a Comment