Wordpress Ajax for connected user failed
source link: https://www.codesd.com/item/wordpress-ajax-for-connected-user-failed.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Wordpress Ajax for connected user failed
I am using wordpress 4.1.1. wp-admin and other several pages (like login, register...) use https connection. My goal is create ajax request for adding tickets to system.
So I can not call function for logged in user it calls function for not-logged in user. But when I add https for this page it`s work fine for me.
Question:
How I can keep user logged in on https and http, so is_user_logged_in()
in amin-ajax.php works fine?
Just need to add one more line with your code :
for logged in users :
add_action( 'wp_ajax_my_request', 'my_request' ); //calling function "my_request" for logged in users only
for non-logged in users :
add_action( 'wp_ajax_nopriv_my_request', 'my_request' ); //calling function "my_request" for non-logged in users
for more information about addition of ajax in wordpress, just check here : http://www.wptricks24.com/how-to-use-ajax-wordpress/
Related Articles
wordpress checks for multiple user IDs
Disable Wordpress Limit for Duplicate User Email
Facebook Like Box is not displayed for disconnected users; only for connected users
In MVC3, how do I use Session for Connected Users in my layout?
Session Verification for Connected Users on Pages / Links?
Design layouts for connected users & amp; Disconnected Resources
Large-scale commerce only displays certain products for connected users
Singleton model for connected user
How to protect a page only for connected users?
Calling HTTPS from HTTP via AJAX for connection
How to restrict a directory only for connected users only: Codeigner
Specify a different path for connected users without using Currency
ASP.Net: Display of buttons only for connected users
ActiveRecord Rails: Default Range for Connected User
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK