Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 仅将转发器字段数据添加到选定的帖子_Php_Wordpress_While Loop_Advanced Custom Fields - Fatal编程技术网

Php 仅将转发器字段数据添加到选定的帖子

Php 仅将转发器字段数据添加到选定的帖子,php,wordpress,while-loop,advanced-custom-fields,Php,Wordpress,While Loop,Advanced Custom Fields,我有一个带有while循环的wp_查询,当我将表单数据提交给其他帖子时,我为每个帖子添加了一个表单,而不是提交给当前选定的帖子 <?php $query = new WP_Query( array( 'post_type' => array('artist', 'musicbrainz'), 'posts_per_page' => $posts, 'order' => 'DESC', 'meta_query'

我有一个带有while循环的wp_查询,当我将表单数据提交给其他帖子时,我为每个帖子添加了一个表单,而不是提交给当前选定的帖子

<?php
$query = new WP_Query( array(
        'post_type' => array('artist', 'musicbrainz'),
        'posts_per_page' => $posts,
        'order' => 'DESC',
        'meta_query' => array(
        array(
            'key' => 'feature_on_site',
            'value' => 'yes',
            'compare' => 'LIKE',
        )),
    ) );

    if ( $query->have_posts() ):?>
            <?php while ( $query->have_posts() ) : $query->the_post(); ?>
            //from code
       <?php
       if ($_SERVER['REQUEST_METHOD'] == 'POST') {

                             $star_ratingg = $_POST['star_ratingg'];
                             $set_comments = $_POST['set_comments'];

                             

                             if (!empty($current_user) && !empty($star_ratingg)) {
                             $field_key = "field_5ee00c7122b0c";
                             $value =
                            array(
                                "field_5ee00cd522b10"   => $star_ratingg,
                                "field_5ee00ce322b11"   => $set_comments,
                            );
                            $p_id = get_the_ID();
                        add_row( $field_key, $value, $p_id );
                        //wp_mail($current_user, $subject, $message );
                            } else { ?>
                        <div class="error-access">
                            <p>Please fill your review form.</p>
                        </div>
                        <?php }
                        }
                             ?>
                             <form name="command" id="review_product_form" class="user_input_form review_product front-reviews" action=""
                            method="post">
                            <input type="text" name="star_ratingg">
                            <input type="text" name="set_comments">
                            <div class="btn_wrap">
                                                        <div class="btn_text"><input
                                                                class="form_btn submit_btn btn-seatgeek btn-purchase"
                                                                type="submit" name="post-review" value="Submit"><input
                                                                type="hidden" name="get_performer" id="get_performer"
                                                                value="<?php echo get_the_title(); ?>"></div>
                                                    </div>
                        </form>

        <?php endwhile; ?>
        <?php endif; ?>

//源代码
请填写你的复习表