Skip to content

papi_ajax blocked when using FORCE_SSL_ADMIN on non SSL site #213

@zombiefredrik

Description

@zombiefredrik

What I expected

papi_ajax to work in admin when doing conditionals (bool show as per example)

What happened instead

papi_ajax call was blocked since it was doing the request to get_bloginfo( 'url' ) and I have define('FORCE_SSL_ADMIN', true);

Steps to reproduce

set bloginfo url to http and turn on SSL as above in wp-config.
paste the sample code from conditionals in docs.

Proposed fix

Change row 34 - function ajax_url() in class-papi-admin-ajax.php
from
$url = esc_url( trailingslashit( get_bloginfo( 'url' ) ) . 'papi-ajax/' );
to
$url = esc_url( trailingslashit( home_url( '/' , is_ssl() ? 'https' : 'http' ) ) . 'papi-ajax/' );

What versions of softwares are you using?

  • Browser: chrome 55.0.2883.95 OSX
  • Papi: 3.x
  • WordPress: 4.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions