Limit posts per author role (excluding admin) in home page

If I understand your problem then this should definitely work. <?php get_header(); $users = get_users( array( ‘who’ => ‘author’ ) );//get all the users with author role in an array foreach ( $users as $user ) { //travers the array if($user->caps[‘administrator’]==1)continue; // skip the user if user also have administrative capabilities $query = new WP_Query( … Read more

Get last revision author, author-link and date

To get the_modified_author() we have to look in the folder wp-includes and search for the author-template.php. Line 101 shows: /** * Display the name of the author who last edited the current post, * if the author’s ID is available. * * @since 2.8.0 * * @see get_the_author() */ function the_modified_author() { echo get_the_modified_author(); } … Read more

get_attached_media() on author page not working

I assume that you have a simple misunderstanding of what this function actually does and what it should be used for: get_attached_media() simply fetches all child posts for a given posts: if ( ! $post = get_post( $post ) ) return array(); $args = array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => $type, ‘posts_per_page’ … Read more

How to remove the dropdown author data from the post edit page

An easy sulotion will be to remove the post type author feature. add_action( ‘init’, ‘remove_cpt_author’ ); function remove_cpt_author() { remove_post_type_support(‘post’, ‘author’); // this function require the post type and the feature you want to remove. }

Filter Author Bio

You can use the filters the_author_$meta and get_the_author_$meta (where $meta is in this case ‘description’): add_filter(‘the_author_decription’, ‘custom_about_member’, 10, 2); add_filter(‘get_the_author_decription’, ‘custom_about_member’, 10, 2); function custom_about_member($description, $userid) { $about = get_user_meta($userid, ‘user_about’, true); if ($about) {return $about;} return $description; } This of course relies on the place where the author bio is being displayed using the … Read more

How to get the user meta data for a post?

You can pass the post’s author as an argument to get_the_author_meta: get_the_author_meta(‘ID’, $post->post_author); The second argument is the user’s ID. This is stored in the post object in your loop, which you can access it by using $post->post_author. Reason The reason behind the current code of yours that isn’t working is this piece of code … Read more

How can I get the author description’s excerpt?

There is none. You have to implement your own custom function to trim any content you wish. For example, this function will trim your content based on words: function my_custom_excerpt ( $content, $limit = 20, $more=”…” ){ return $data = wp_trim_words( strip_tags( $content ), $limit, $more ); } Or this one will trim it based … Read more

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