Articles of session

How does WordPress handle sessions?

I know that WordPress is stateless and doesn’t use any global session variables, but when a user logs in via WordPress, it must somehow keep track of who is logged in, right? Does WordPress keep track of that in cookies? I’m working on a plugin that must keep track of something similar. I can easily […]

How can I test the login for an expired session?

I’m developing a login plugin and need to test the login form that pops up after a session has expired. I would like to see the popup appear on my request. Any hack is fine. Ideally some little javascript to run from the console.

integrating external php library into wordpress- the right way

If I were to load a custom library into wordpress, what would be the best place to add it? Since there are a bunch of global vars defined at the top of the library, I would not want that to be done thru a hook where I’m forced to use a wrapper function whereby my […]

Custom Connect to Facebook, problem logging in/logging out

I am working on a custom function for login in my users via facebook. I started by reading this nice tutorial on how to login in via facebook: The function will log in the user to wordpress if an account with his/her facebook email already exists in the wordpress blog. If it doesnt exist, […]

Custom query form submission pagination

There is a question very similar to mine, which can be found here. The difference with my question is: my search form is on several pages (page.php and single.php) and I don’t use wp-pagenavi. I’ve tried the suggested solutions posted there but they didn’t work. What is working The query displays the right results The […]

Should I store my Facebook access tokens?

I’ve built a custom login page for a WordPress site which uses Facebook for authentication. Is there any reason to store the Facebook access token in my WP database, or does it make more sense to use a PHP session? Are there any benefits to storing these values on my server?

2 different post->IDs for single page load only in Firefox

I am saving the post->ID in a session array to keep a history of the accessed pages for a specific custom post type. This code was added to that specific custom post type’s template, so that the session data only updates for requests for this type. So, if the user loads the page with postID […]

SESSION in WordPress Plugin Development

I wondering the session was disable in wordpress. I try to find some information on using session variables in the wordpress. I tried the following method to implement session variables in the wordpress site. I tried this way. <?php session_start(); $_SESSION[‘firstname’] = $_POST[‘firstname’]; ?> If i echoing the $_SESSION[‘firstname’] is not come’s up. So I […]

Random popup image per user with no repeat

I am pulling images from an ACF gallery that resides on another page. What I intend to do with this is to have these images displaying full screen on my home page on a popup every time the page loads. However, when a website user lands on the home page a random image should popup […]

Share session between my site and WP blog

I am using Yii framework for a web site and WP for a blog (don’t ask why, I inherited this project). Yii is responsible for users (login/logout…), and in the blog (WP), I need to know when the user is logged in. I tried setting session in Yii, $_SESSION[‘key’] = $value, and reading it in […]