Plugin Author
RazyRx
(@razyrx)
Hi,
On update the products plugin trying to get products from file wp-admin/admin-ajax.php, but can’t get access to this file, please check that you doesn’t block access to this file.
Regards,
Oleg
Hi Oleg,
Thanks for the reply! unfortunately I have to little knowledge to say if I am blocking access. But i think you are right:
”
if ( is_user_logged_in() ) {
/**
* Fires authenticated AJAX actions for logged-in users.
*
* The dynamic portion of the hook name, $_REQUEST['action'],
* refers to the name of the AJAX action callback being fired.
*
* @since 2.1.0
*/
do_action( ‘wp_ajax_’ . $_REQUEST[‘action’] );
} else {
/**
* Fires non-authenticated AJAX actions for logged-out users.
*
* The dynamic portion of the hook name, $_REQUEST['action'],
* refers to the name of the AJAX action callback being fired.
*
* @since 2.8.0
*/
do_action( ‘wp_ajax_nopriv_’ . $_REQUEST[‘action’] );
}
// Default status
die( ‘0’ );
”
Is it just a matter of copy pasting the code from the logged-in code onto the logged-out code?
I have found the solution. You were right the ajax.php was being blocked.
I used
”
# Allow access to wp-admin/admin-ajax.php
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>”
”
To solve it. Can you tell me if this is safe to use like this?
Plugin Author
RazyRx
(@razyrx)
Hi,
yes, this is safe, because by default this file is open for any access.
Regards,
Oleg
Thanks a lot, you are the man:)