Redirect returning users to a certain page?

function redirect_user() { if ( is_user_logged_in() ) { wp_redirect( ‘http://yoursite.com/page/’ ); exit; } } add_action( ‘init’, ‘redirect_user’ ); This will redirect the user to the page of your choice if they are logged in. It might be necessary to add a conditional that checks to make sure the user isn’t already on that page, to … Read more

Adding Dynamic Stylesheet

This is the recommended way to add a custom or second style sheet for child themes: function custom_style_sheet() { wp_enqueue_style( ‘custom-styling’, get_stylesheet_directory_uri() . ‘/css/custom.css’ ); } add_action(‘wp_enqueue_scripts’, ‘custom_style_sheet’); You can also add style sheets conditionally http://wpsites.net/wordpress-themes/second-style-sheet-theme/

Create an user on external database

No matter how you create a new user, it will end up calling wp_insert_user, which runs the action user_register right before finishing. So you can do something like the following: add_action(‘user_register’,’register_user_remotely’); function register_user_remotely($user_id) { //add user to external database $url = …; //url of file that will receive the $user->data in the $_POST variable $user … Read more

how to display a string in admin_notices hook from a class plugin

Take a look at what happens when you activate a plugin. That is, watch the event with something like HttpFox or Wireshark. After activation the page is redirected back to itself with $_GET parameters appended. For example: wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s= Notice, activate=true?. Your code isn’t working, I am pretty sure, because there are two requests involved. You … Read more