Show Author in custom rss feed

Try it: <?php echo get_the_author_meta( ‘display_name’, $post->post_author ); ?> You can use the_author function in wordpress standard loop, Not foreach. to set global author information you should use the_post function. but in foreach, you can use get_the_author_meta instead of the_author to pass author id $post->post_author.

Current post’s author name in the author meta tag

You cad add it via functions.php with a hook, instead of inside the loop (you don’t really want to add a loop to header.php): function add_author_meta() { if (is_single()){ global $post; $author = get_the_author_meta(‘user_nicename’, $post->post_author); echo “<meta name=\”author\” content=\”$author\”>”; } } add_action( ‘wp_enqueue_scripts’, ‘add_author_meta’ );

Author archive only for custom post type

According to this blogpost you just need to add the following code to your themes functions.php or in a plugin: /* Add CPTs to author archives */ function custom_post_author_archive($query) { if ($query->is_author) $query->set( ‘post_type’, array(‘custom_type’, ‘post’) ); remove_action( ‘pre_get_posts’, ‘custom_post_author_archive’ ); } add_action(‘pre_get_posts’, ‘custom_post_author_archive’);

htaccess rewrite for author query string when WP is in subfolder

The question is about doing this with .htaccess, but why not disabling author pages from within WordPress instead? This would achieve the same result while making the subdirectory concern irrelevant altogether (and also works regardless of permalink structure settings) Sample code that sets all urls to author pages to a 404 error: add_action( ‘template_redirect’, function() … Read more

How to hide/redirect the author page

You can do this at an earlier moment by hooking into the right action, like template_redirect, which fires right before the template will be displayed. add_action( ‘template_redirect’, ‘wpse14047_template_redirect’ ); function wpse14047_template_redirect() { if ( is_author() ) { $id = get_query_var( ‘author’ ); // get_usernumposts() is deprecated since 3.0 $post_count = count_user_posts( $id ); if ( … Read more

Query posts distinct authors

With what you are asking, it is really difficult to come up with some performant easy way that is also reliable. As @birgire already stated, his solution is not reliable, but from tests, it seem to be the fastest clocking in at 2 db queries in about 0.015s average. From a quick discussion between @birgire … Read more

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