WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress HTTPS (SSL)] WordPress HTTPS breaks AJAX calls to admin-ajax.php

[Resolved] [Plugin: WordPress HTTPS (SSL)] WordPress HTTPS breaks AJAX calls to admin-ajax.php

Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, I had similar issue, so I copied admin-ajax.php to my theme directory and removed the unneeded stuff. Then use it for your ajax calls instead of the wp-admin one.

    Reffer to the file:

    <?php get_template_directory_uri(); ?>/admin-ajax.php

    This is my admin-ajax.php according the latest WP 3.4.2:

    <?php
    /**
     * WordPress AJAX Process Execution.
     */
    
    define( 'DOING_AJAX', true );
    
    /** Load WordPress Bootstrap */
    require_once( '../../../wp-load.php' );
    
    /** Allow for cross-domain requests (from the frontend). */
    send_origin_headers();
    
    // Require an action parameter
    if ( empty( $_REQUEST['action'] ) )
    	die( '0' );
    
    @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
    @header( 'X-Robots-Tag: noindex' );
    
    send_nosniff_header();
    
    add_action( 'wp_ajax_nopriv_autosave', 'wp_ajax_nopriv_autosave', 1 );
    
    if ( is_user_logged_in() )
    	do_action( 'wp_ajax_' . $_REQUEST['action'] ); // Authenticated actions
    else
    	do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); // Non-admin actions
    
    // Default status
    die( '0' );

    Hope this helps!

    How about other plugins? This is a good solution for your own code. But what if your not working with your own code. There should be a way to add an exception for admin-ajax.php.

    Plugin Author Mike Ems
    Member

    @mvied

    I’ll have a fix out in the next release. If you’d like, try the development version and let me know if it works for you.

    infobydesign
    Member

    @infobydesign

    I’ve been pulling my hair out over this Ajax issue for weeks – after installing the Dev version of your plugin, the problem is resolved. Many thanks!

    Just to let people know that installing the Dev version (3.4.0b) still fixes this problem, with no settings changed. Great plugin by the way.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: WordPress HTTPS (SSL)] WordPress HTTPS breaks AJAX calls to admin-ajax.php’ is closed to new replies.