WP-Admin edit.php & post.php slowdown after import of 10k users

Situation: Clean wordpress install No plugins VPS server 5.2ghz / 4gb RAM (Default Directadmin) Import of 10k users Problem: WP-Admin edit.php and post.php take >4sec to load. A custom post type without the ‘Author’ support loads quickly What I tried: https://core.trac.wordpress.org/ticket/28160, didn’t work Question: What to do to get it fast again? 1 Answer 1 … Read more

How to make an author archive only for certain user role and show related CPT

Scenario I made a CPT where I’m taking the stakeholder’s ID as a custom field. All the stakeholders are actually a WordPress’ Registered User with a different role stakeholders – because at some point I need them to login to post their own content. So what actually I’m doing, I’m grabbing the userID and passing … Read more

How to fetch custom post by Author?

Here is code , basically I want to fetch by Post author but not able to solve this any help regards this . <?php global $post; $author = get_the_author(); $args = array( ‘author’ =>$user_ID, ‘posts_per_page’ => $per_page, ‘author’=> $author, ‘post_type’ => ‘ultimate-auction’, //’auction-status’ => ‘expired’, ‘post_status’ => ‘publish’, ‘offset’ => $pagination, ‘orderby’ => ‘meta_value’, ‘meta_key’ … Read more

I only want to Display Author Link in authors bio

the_author_link() displays author name with hyperlink. I only want authors link to display and not authors name with hyperlink. how i suppose to do that?. thanks 2 Answers 2 You may consider using this function : get_the_author_meta(‘url’) You can see here the implementation of the function get_the_author_link() and you will see how they construct the … Read more

WP rest api returns 404 only when author param is used

I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case. /wp-json/wp/v2/posts?author=<some int> For everything else, including my custom endpoints, and custom params/fields added to the api, it works perfectly. But the moment i add the author part, … Read more

Limit REST API output to current logged in user that is also author of the content

https://developer.wordpress.org/rest-api/using-the-rest-api/frequently-asked-questions/#require-authentication-for-all-requests This requires authentication for all reque​sts. add_filter( ‘rest_authentication_errors’, function( $result ) { if ( ! empty( $result ) ) { return $result; } if ( ! is_user_logged_in() ) { return new WP_Error( ‘rest_not_logged_in’, ‘You are not currently logged in.’, array( ‘status’ => 401 ) ); } return $result; }); Now when I add a … Read more

Get attachment next and previous by author only

I’m trying to get the next and previous attachment by the user it’s currently displaying, this is what I have and it works great except it gets all of the attachments instead of just the ones from a specific user. <p> <?php $attachment_size = apply_filters( ‘twentyten_attachment_size’, 900 ); echo wp_get_attachment_image($post->ID, array( $attachment_size, 9999) ); // … Read more

What is wrong with this code?

function themeperauthor_need_switch() { global $post; if ( $get_post_type == ‘weblogs’ ) { return get_the_author_meta(‘themeperauthor’, $user->ID); } return “”; } It doesn’t return anything 3 Answers 3 You are using get_post_type as variable instead of a function try: function themeperauthor_need_switch() { global $post; if ( get_post_type($post) == ‘weblogs’ ) { return get_the_author_meta(‘themeperauthor’, $user->ID); } return “”; … Read more