PHP Mistake – Whats wrong here?

From the official code reference: wp_redirect() does not exit automatically, and should almost always be followed by a call to exit; So, you need to call exit after the redirect: $curauth = (get_query_var(‘author_name’)) ? get_user_by(‘slug’, get_query_var(‘author_name’)) : get_userdata(get_query_var(‘author’)); if ( get_user_role($curauth->ID) === ‘subscriber’ ): wp_redirect( ‘http://redirect-here.com’ ); exit; //here! endif;

Creating a button from data from Author meta

You just created an empty link, it has correct link but no inner text: echo ‘<a href=”‘ . esc_url( the_author_meta(‘snapchat_profile’)) . ‘”>Follow on Snapchat</a>’; And since you already stored the link in $snapchat_profile variable, no need to call the the_author_meta(‘snapchat_profile’) function once again (it will only reduce in a few bits of extra memory usage … Read more

Add a menu item to the logged in users author page?

You can use wp_nav_menu_items filter for this, and check if user logged in, and use get_author_posts_url($autho_id) as bravokeyl suggested: add_filter(‘wp_nav_menu_items’, function( $items, $args ) { $index = ‘top-menu’; // menu index key, if you’re not sure then var_dump( $args->theme_location ) global $current_user; if ( $current_user->ID && $index === $args->theme_location ) { $items .= sprintf( ‘<li … Read more

Author archive custom posts only?

You want to only query posts from the post-type direct_blog, but NOT the normal post type? Than you simply need to remove post from this line: $query->set(‘post_type’, array(‘post’, ‘direct_blog’)); Update: I just tested the following code. First you need to revisit your function, as you have some errors in it. In the code in your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)