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

If you paste a Tweet URL to your post, Wordpress will nicely render it.

But if I load posts via Ajax, the URL gets replaced by a Blockquote, but not with the nicely rendered one. The class of the Blockquote is twitter-tweet and not, as intended twitter-tweet-rendered with all that extra stuff.

This is what it looks like loaded via Ajax:

enter image description here

And this is what it looks like loaded by normal request:

enter image description here

So is there any Javascript action that I could fire to render that Twitter Feed?

This is how I load it:

            url: link, // this is generated via the "next_posts" link
            success: function(respond) {

                // get the right content
                var $result = $(respond).find('.content article');

                // append the content
                $('.content').append( $result );

            error: function(html) {

Alternate Ajax request:

            action : 'return_tweet_post'
        function( respond ) {
                    // append it

And the PHP action for it:

add_action( 'wp_ajax_nopriv_return_tweet_post', 'return_tweet_post' );
add_action( 'wp_ajax_return_tweet_post', 'return_tweet_post' );
function return_tweet_post() {
    $my_query = new WP_Query('p=1165');
    if( $my_query->have_posts() ) {
        while ($my_query->have_posts()) {


Gives the same result.

share|improve this question
Please elaborate how are you retrieving content via Ajax. It might be relevant to how oEmbed handles things. – Rarst Oct 14 '12 at 20:05
thanks, I've added the Ajax action – xsonic Oct 15 '12 at 12:57
So you are ripping post content out of normal web page?.. Why not properly request it via Ajax from backend? – Rarst Oct 16 '12 at 19:40
I've tried a "proper" Ajax request (if you mean using wp_ajax by "properly request it"), but it returns the same result – xsonic Oct 17 '12 at 13:03
up vote 2 down vote accepted

ok, got it.

Need to embed

<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>


And then fire twttr.widgets.load(); after appending the posts.

Thx anyways, Rarst

share|improve this answer

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.