I try to create code for a site where users can give adverts. Program is for users who don’t have account on that site but they want to add ads. I want my program to send the first ad to moderator who will check it. if everything is ok, he publishes the ad and if user wants to add another advert and uses the same email, his/her new advert will be added automatically.

My code at the moment:

$posts = get_posts( array(
    'author' => get_current_user_id(),
        'post_type' => 'advert',
        'post_status' => array("publish", "expired"),
        'posts_per_page' => 1
    ) );
$args = array(
    'post_type' => 'advert',
    'meta_query' => array(
            'key' => 'adverts_email' == $adverts_email,
            'value' => 'yes',
  if( false ) {
        return $out;

$postslist = get_posts( $args );

  if( empty( $posts ) ) {
        return $out;

Please, if someona know how make it. i start programing and i want learn but i try find answer on this 2 day and i found nothing.

Thanks and sorry for waste you time.

Read more here: i have a php program for wordpress site with adverts but it doesn’t work


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: