This is odd and I can't figure out why it won't work.
I've got a file that uses a wordpress function to call up certain information, for this example, I'll just call up the title of my blog.
I'm doing this outside of wordpress, so I start with "require('wp-blog-header.p
hp')" as per the documentation here: https://codex.wordpress.org/Integrating_WordPress_with_Your_Website
So this is the script (named test.php)
I can go to test.php in my browser and it shows the name of the blog. All is well.
Now, I want to place the results of this script onto another page using jquery, so I do this on a second page:
$( "#menutest" ).load( "test.php" );
I go to the page with that html/jquery and the blog name does not appear.
If I redo the php file and just put:
I can reload the html page and the word "test" shows. So I know the jquery is working.
For some reason, it seems like the php script, maybe the "require('wp-blog-header.p
hp');" part, isn't working when I access it through the jquery load method.... but that doesn't make sense to me, because it seems like the php file would be parsed the same no matter how it was accessed. No?
Any thoughts on why this isn't working?
(in real life, the plan is to access a special menu and load it with jquery, this is a simple and repeatable example of the same problem.)
Appreciate any help on this -
I've attached the two files I am using if you would like to load them on your wp install for testing.