How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?

You can set the author base independently by manipulating the $wp_rewrite global: function wpa55976_author_base() { global $wp_rewrite; $wp_rewrite->author_base=”authors”; $wp_rewrite->author_structure=”https://wordpress.stackexchange.com/” . $wp_rewrite->author_base . ‘/%author%’; // EDIT – rewrite rule to force author urls to resolve: add_rewrite_rule(‘authors/([^/]+)/?$’, ‘index.php?author_name=$matches[1]’, ‘top’); } add_action( ‘init’, ‘wpa55976_author_base’ ); Make sure to visit your permalinks page to flush rewrites after you add … Read more

Allow shortcode in the author bio textarea

It a matter of using do_shortcode in your author.php template file (or wherever applies). This function has to be “echoed”. And instead of using the_author_meta (which echo‘s the result), use get_the_author_meta. <?php echo do_shortcode( get_the_author_meta( ‘description’ ) ); ?>

Get Author for Single Post in Custom Post Type

There are several functions for this available, like: the_author, for displaying; get_the_author, for returning. There is no restriction regarding custom post types, but those template tags only work inside the loop. If you want to get more author information then the name you can use: the_author_meta, displaying; get_the_author_meta, returning. The latter two functions can also … Read more

Why are authors allowed to approve comments on their posts? How to revoke privilege?

The ability to set comment status is tied to the “edit_comment” capability, which is a meta-capability in WordPress. It maps to the “edit_post” capability, which is another meta-capability that varies depending on whether a post is published or not. In the end, if a post is published, then edit_comment ends up mapping to “edit_published_posts” for … Read more

Is it possible to get_terms by author?

Not directly, because terms are assigned to posts, not authors. You will need to query all posts, get their terms and authors, and then filter out terms which came with posts that have other authors than get_query_var(‘author’). Note that depending on the number of posts your site has, this kind of query could be very … Read more

How can I add “posted by ‘author'” to each post?

A plug-in might use the_content filter to append / prepend this, but if you’re a theme author or otherwise are able to edit the the theme templates directly. In this case you want to edit your theme’s single.php. (You can always check which template file is being used by a particular page using this answer: … Read more

Check if author or current user has posts published

Using get_posts or WP_query with similar $args: $args = array( ‘post_type’ => ‘your_custom_post_type’, ‘author’ => get_current_user_id(), ); $wp_posts = get_posts($args); if (count($wp_posts)) { echo “Yes, the current user has ‘your_custom_post_type’ posts published!”; } else { echo “No, the current user does not have ‘your_custom_post_type’ posts published.”; }

the_author() not working outside the loop

I will answer my own question here. The reason the user information didn’t display is because the php tags need the author ID when used outside the loop. For instance the following tag: <?php the_author(); ?> Should be like this: <?php the_author_meta(‘display_name’, 1); ?> This is explain quite well here. Now the code works just … Read more

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