Using WordPress functions in External Files

if you want to use WordPress functions in external PHP scripts, you can do it by including wp-blog-header.php file. But the script may send “404 File not Found” header in some cases. For example, if you name it ‘index.php’, put it in a directory and call the directory, the page may appear in your browser, but using a header checking tool like web developer toolbar, you can see that it actually sends 404 headers. The same thing happens if you use mod_rewrite to do internal redirection to your script. Your page will not get indexed by Search Engines.

The fix: add “200 OK” header.


require('/path/to/wordpress/wp-blog-header.php');
header("HTTP/1.1 200 OK");
/* Your code  goes in here */

Or get RSS feed

This entry was posted on Friday, May 15th, 2009 at 3:15 pm and modified at 5:21 pm. You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Comments : 6

  1. Thanks. Just what i need.

    Normes

  2. Приветики! Читаю не первый день странички. Да вот скорость соединения хромает. Как можно подписаться на вашу RSS-ленту? Хотел бы читать вас и дальше.

    Антон

  3. Пока просто буду знать))))

    Знакомства

  4. Я извиняюсь, но, по-моему, Вы не правы. Предлагаю это обсудить.

    Знакомства

    1. Да, мы можем обсудить. Вы говорите Английский?

      webmasterview

  5. Hello, I found your blog in a new directory of blogs. Your blog looks good. Have a nice day.

    alex farguson

RSS feed

follow

Be a Fan

Google+ Page