WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to render content generated by a php file in [jQuery Colorbox][1] through AJAX in my WordPress site. The PHP resides on the same server in the same domain. It works perfect when I run it on localhost but it's not working on the server.

Here is the link to my site - http://shabdcreatives.com/portfolio

The links themselves are not invalid, for example the following link works fine on its own:


I just won't open inside the colorbox.

Also the php file I am trying to load is just a fragment and DOES NOT CONTAIN any or tags.

I tried the colorbox support group but no replies from them yet

This is the code in the CatGridPost.php file that i am calling in the colorbox.. i tried calling a plain text file too... it returned no error.. but the colorbox did not show its contents either

$thepost = get_post($_GET["ID"]);
$thecontent = $thepost->post_content;
$thetitle = $thepost->post_title;
$thelink = get_permalink($_GET["ID"]);
<div id="cg-post-container">
<div id="cg-post-title">
<a href="<?php echo $thelink; ?>"><?php echo $thetitle; ?></a>
<div id="cg-post-content">  
    <?php echo $thecontent; ?>
share|improve this question
up vote 3 down vote accepted

You should not load wp-blog-header.php yourself.

Use wp-admin/admin-ajax.php instead, as described here:


share|improve this answer
im sorry i dont understand wot i have to do.. plus it is working just fine on localhost... please can u elaborate more.. i dint get it through that link – ansh Jul 3 '11 at 16:43
Since you're loading WP manually, it's sending a 404 header, while also outputting the correct content. Let me know what exactly is unclear in the tutorial I linked to. – scribu Jul 3 '11 at 17:08
i dint get what exactly i hv to modify.. just the php.. or the colorbox js? .. im sorry . im a newbie.. :S – ansh Jul 3 '11 at 17:15
I would suggest getting the code on the codex working, then figure out how to modify it for your case. – scribu Jul 3 '11 at 17:19
yea i got it to work... thanx.. i shouldnt have loaded wp-blog-header.php – ansh Jul 4 '11 at 13:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.