Posts tagged users

How to add a user to WordPress programmatically

In a recent development project I needed to add a user to WordPress programmatically because I had no WP user data but only access to FTP. If this is your case, here is the code I used to add myself to the WordPress users:

WordPress: Prevent admin access for logged in users

For some webdesign projects, you may need to prevent admin access for logged in users. To do so, simply paste following snippet to your functions.php file: function prevent_admin_access() { if ( false !== strpos( strtolower( $_SERVER[‘REQUEST_URI’] ), ‘/wp-admin’ ) && !current_user_can( ‘administrator’ ) ) wp_redirect( home_url() ); } add_action( ‘init’, ‘prevent_admin_access’, 0 ); This code […]



NS Weight Release