Limit Post Creation Count by Author or Role

I have a site that offers non-paying members up to 5 posts using this: function author_post_count($user_id, $post_type = array(‘YOUR_CUSTOM_POST_TYPE_NAME_HERE’)) { $args = array( ‘post_type’ => $post_type, ‘author’ => $user_id, ‘posts_per_page’ => -1 ); $query = new WP_Query($args); return $query->found_posts; } Then I use: if ( author_post_count(get_current_user_id()) >5) { SHOW RESTRICTION NOTICE CODE HERE FOR USERS … Read more

Posts missing on author page

It’s best not to edit theme files directly, because when you update the theme, your changes are lost. Instead, if you need to change things, create a child theme and you can do whatever you need there. To restore the previous file you can either download a fresh copy of your theme, or look through … Read more

WordPress Custom Local Avatar not showing in comments

I found a solution and now my frontend avatar script is fully functioning. Happy days 🙂 I ended up scrapping the above code and using this. add_filter( ‘pre_get_avatar_data’, ‘wad_avatar_meta’, 10, 2 ); function wad_avatar_meta( $args, $id_or_email ){ $user_avatar_meta_key = ‘avatar’; if( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ){ $id_or_email = get_comment( $id_or_email ); } … Read more

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