Pass a php variable from a WordPress post to a WordPress script

Posted on November 11, 2007

Here’s a little trick to pass a php variable from a WordPress post to you php scripts on your server

It took me a bit for this one, but it was pretty simple. In WordPress use your favorite plugin that lets you pass php in your blog, in my case I use InlinePHP. Surround your variable with something like, [phptag] global $keyword; $keyword=”wordpress”;[/phptag]. Now in you php files related to WordPress, you would do the same thing, call global $keyword, and you can use that variable in your script.

The main key to remember is to call your php variable GLOBAL.

inlinePHP

Categories: Programming


Leave a Reply