Email Subscribe for Downloads in WordPress

The following is not the best solution. It is a simple solution that can be / should be improved and it is intended only to give you a direction. Create a CPT ‘resource’. register_post_type(‘resource’, $args); For args refer here. Under your WP root folder (the one where you have /wp-admin, /wp-includes and /wp-content), via FTP … Read more

How to create a specific role to manage users

The following capabilities are needed to fully manage users: create_users edit_users promote_users delete_users remove_users list_users Remove role, you’ve created with Members plugin. Add the following code to functions.php of your active theme: add_role( ‘users_manager’, __( ‘Users Manager’ ), array( ‘read’ => true, ‘list_users’ => true, ‘promote_users’ => true, ‘remove_users’ => true, ‘edit_users’ => true, ‘create_users’ … Read more

get Discussion setting in wordpress

this code may help you $status = get_option(‘comment_registration’); // 1 : Yes , user must be registered and logged in for commenting // 0 : No (default) You can use the following code for the comment section if (comments_open($postId)) { if (get_option(‘comment_registration’) == 0 || is_user_logged_in() ){ //render comments section }else{ echo “You must login … Read more

Redirect user based on role when they try access a particular page

function redirect_non_vendors() { global $wp; $user = wp_get_current_user(); $role_needed = ‘vendor’; $page_to_check = ‘secret/page/url’; $redirect_url = home_url( ‘/go-here/’ ); if ( ! in_array( $role_needed, (array) $user->roles ) && $page_to_check === $wp->request ) { wp_redirect( $redirect_url ); exit; } } add_action( ‘template_redirect’, ‘redirect_non_vendors’ ); You’ll want to replace three things here: vendor: the role that someone … Read more