WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Jetpack Photon with admin-ajax.php (6 posts)

  1. akis
    Member
    Posted 10 months ago #

    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/

  2. akis
    Member
    Posted 10 months ago #

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

    Should be there by default I think.

  3. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 10 months ago #

    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!

  4. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 7 months ago #

    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!

  5. akis
    Member
    Posted 7 months ago #

    Thank you!

  6. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 7 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.