Get all posts by post_author

The shortest possible answer would be to correct ‘post_author’ to ‘author’, since that is the key WP is looking for. If a key is incorrect or misspelled it will be ignored, as was the case with ‘post_author’.

Custom function for “Submit for Review” hook

You need Post Status Transitions actions function notify_me_for_pending( $post ) { $user_info = get_userdata ($post->post_author); $strTo = array (’[email protected]’); $strSubject=”Fstoppers: ” . $user_info->user_nicename . ‘ submitted a post’; $strMessage=””” . $post->post_title . ‘” by ‘ . $user_info->user_nicename . ‘ was submitted a post for review at ‘ . wp_get_shortlink ($post->ID) . ‘&preview=true. Please proof.’; wp_mail( … Read more

How to Display Post View Count

Add this to single.php, and make sure you paste in inside the loop. <?php setPostViews(get_the_ID()); ?> Lastly, to display the number of views a post has, just add this where you want it to be displayed: <?php echo getPostViews(get_the_ID()); ?> . <?php // function to display number of posts. function getPostViews($postID){ $count_key = ‘post_views_count’; $count … Read more

How to display post tags

I think you are searching for the get_tags() function. You would need to place it into the single-post.php (or single.php if your theme doesn’t have a single-post.php) (to find the right template file you can always look up at WordPress Template Hierarchy). To echo a list of tags with the aboved linked function you would … Read more

exclude particular posts in archive.php

You can exclude posts from archive pages with thee help of pre_get_posts action. Usually pre_get_posts is used to modify main query, so it’s best solution for your problem. function my_custom_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query() ) return; if ( $query->is_archive() ) { $query->set( ‘post__not_in’, array( 7, 11, 21 ) ); } … Read more

Disable REST API for a user ROLE

The plugin has a filter drh_allow_rest_api which determines whether the current user has full access and can skip the whitelist check. By default this is just is_user_logged_in(): /** * Allow carte blanche access for logged-in users (or allow override via filter) * * @return bool */ private function allow_rest_api() { return (bool) apply_filters( ‘dra_allow_rest_api’, is_user_logged_in() … Read more