最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp query - How do I get all authors posts of a custom post type outside loop

matteradmin7PV0评论

I'm trying to create a utility script that to add some metadata into all posts of a certain post type. Right now I have it set up to loop through all users

$blogusers = get_users(array(
        'role'     => 'freelancer'
));

for( $i = $index;  $i < count($blogusers); ++$i) {

    $user = $blogusers[$i];

    $userID = $user->ID; // set to user id

    $profile_id = get_user_meta( $userID, 'user_profile_id', true);

    $user_reach = get_post_meta( $profile_id, 'total_reach', true);

    $user_engagement = get_post_meta( $profile_id, 'total_starpower', true);

    $user_rating = get_post_meta( $profile_id, 'rating_score', true);

    write_log("working on " . $user->user_login);
}

I want to copy user_reach, user_engagement, and user_rating into the meta of all of the users posts of BID post type.

Post a comment

comment list (0)

  1. No comments so far