• Resolved akis

    (@akis)


    Hi,

    I’m interested if it’s possible to load Photon with admin-ajax.php
    Here’s what I have:

    function mfields_ajax_show_post() {
        $id = ( isset( $_GET['p'] ) ) ? (int) $_GET['p'] : false;
        query_posts( array( 'p' => $id ) );
        if ( have_posts() ) {
            while( have_posts() ) {
                the_post();
                get_template_part('content');
            }
        }
        exit;
    }
    
    add_action( 'wp_ajax_mfields_show_post', 'mfields_ajax_show_post' );
    add_action( 'wp_ajax_nopriv_mfields_show_post', 'mfields_ajax_show_post' );

    /wp-admin/admin-ajax.php?action=mfields_show_post&p=25 works fine but it doesn’t filter the image url through Photon.

    Any help?

    http://wordpress.org/plugins/jetpack/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter akis

    (@akis)

    Ok, in case anyone is interested I have added && !(defined('DOING_AJAX')) on class.photon.php:340

    Should be there by default I think.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Good call. I created a trac ticket about this issue, and we’ll look into it.
    http://plugins.trac.wordpress.org/ticket/1885

    Thanks for the report!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I just wanted to let you know that we fixed the issue and will include that fix in the next Jetpack release.

    Thanks again for the report!

    Thread Starter akis

    (@akis)

    Thank you!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m afraid I’ve had to revert that commit: it was applying Photon to all images inserted into posts via the Media uploader in the admin. That’s something that shouldn’t happen, since it makes it a lot more difficult if you need to stop using Photon later on.

    I’ve reopened the trac ticket, and we’ll look for a better solution.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Jetpack Photon with admin-ajax.php’ is closed to new replies.