posts

Hide the author box for a specific ‘Author’ user

function custom_show_linked_author_meta_before_content($content) {global $post; // Get the post author’s ID$author_id = $post->post_author; // Get the user object for the post author$author_user = get_userdata($author_id); // Check if the post author has the ‘author’ roleif ($author_user && in_array(‘author’, $author_user->roles)) {// Get the author name and author archive URL$author_name = get_the_author_meta(‘display_name’, $author_id);$author_archive_url = get_author_posts_url($author_id); // Display the linked […]

Hide the author box for a specific ‘Author’ user Read More »

Custom filters: Single post show author meta for Authors

// Add this in you single post template // See https://developer.wordpress.org/themes/basics/template-hierarchy/ // First we get the author role: global $authordata; // The author object for the current post. See https://codex.wordpress.org/Global_Variables $author_roles = $authordata->roles; // Get all author roles. See https://codex.wordpress.org/Class_Reference/WP_User $author_role = array_shift( $author_roles ); // Get the user role // Now we check if

Custom filters: Single post show author meta for Authors Read More »

Scroll to Top