User redirect to destination URL after login

Scenario: if user not login, user redirect to customize login page and redirect again to destination page after login. I don’t use a function or plugin. This code to restriction page: if (!is_user_logged_in()){ wp_redirect( get_option(‘home’) . ‘?redirect_to=’ . esc_url($_SERVER[“HTTP_HOST”] . $_SERVER[“REQUEST_URI”]) ); } successfully to user login but in login page the URL change to … Read more

Correct Post Count ( All | Published | Drafts | Pending | Trash ) for Custom Post Type when restricting to view own posts

I want to restrict users in wordpress to view their own post and media items only. Following the steps given in the below link I have developed the plugin to restrict users to view the own posts and media items only. https://wordpress.stackexchange.com/a/34858/12615 // Show only posts and media related to logged in author add_action(‘pre_get_posts’, ‘query_set_only_author’ … Read more

simple solution for restricting access to (some) uploads/downloads

Initial Situation For a site I’m setting up I was looking into the whole field of securing uploads/downloads and restricting access to them based on user roles/capabilities. Of course I have read some of the previous questions related to the (general) topic on here, for reference reasons the most important/interesting ones I found: How to … Read more

How to restrict attachment download to a specific user?

I have a very specific use case where the site built for a lawyer and each of his clients can login to their own ‘specific page/portal’ (custom post type) without the ability to access wp-admin etc. (I created all the login/register/profile-editing pages in the front end). In this page/portal the lawyer will leave messages and … Read more