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.

  • Please elaborate how are you retrieving content via Ajax. It might be relevant to how oEmbed handles things.
    – Rarst
    Oct 14, 2012 at 20:05
  • 1
    So you are ripping post content out of normal web page?.. Why not properly request it via Ajax from backend?
    – Rarst
    Oct 16, 2012 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, 2012 at 13:03

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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