Php 每页Wordpress管理帖子
这个问题与WordPress4.5.3、ACF3.8.8、ajax和php有关 我有一个自定义字段,其中包含从嵌入ajax响应的post类型检索的数据。现在,问题是即使我添加Php 每页Wordpress管理帖子,php,jquery,wordpress,Php,Jquery,Wordpress,这个问题与WordPress4.5.3、ACF3.8.8、ajax和php有关 我有一个自定义字段,其中包含从嵌入ajax响应的post类型检索的数据。现在,问题是即使我添加posts\u per\u page=>-1,它也会返回与默认博客帖子数相等的帖子。我可以排除这一点,并得到所有的职位 我尝试使用query_posts和sending show posts参数,但不排除默认的博客文章大小。可以这样做吗,因为我只需要在admin中更改每页的这篇文章,if(is_admin())并排除默认的博
posts\u per\u page=>-1
,它也会返回与默认博客帖子数相等的帖子。我可以排除这一点,并得到所有的职位
我尝试使用query_posts和sending show posts参数,但不排除默认的博客文章大小。可以这样做吗,因为我只需要在admin中更改每页的这篇文章,if(is_admin())
并排除默认的博客文章编号
Return only 10
ajax request code :
$.ajax({
type: "GET",
url: "../wp-content/themes/megaintl/inc/admin.php?post_w=taxonomyTripEdit&tId=" + pId,
async: false,
success: function (data) {
console.log(data);
var results = JSON.parse(data);
//var i = 1;
$.each(results, function (key, data) {
var stringArray = data.split('-');
var selectedKey = stringArray.slice(1).join('-');
//alert(selectedKey);
if (selectedKey != '') {
var selectKey = selectedKey;
$('#acf-field_57b13a3e248ad').append($('<option ' + selectKey + '></option>').val(stringArray[0]).html(stringArray[0]));
} else {
$('#acf-field_57b13a3e248ad').append($('<option></option>').val(data).html(data));
}
});
}
});
admin.php
if(isset($_GET['tId'])) {
$terms = get_terms( array(
'taxonomy' => 'trip_category',
'hide_empty' => false,
) );
foreach ($terms as $term) {
//echo $term->term_id;
if ($term->term_id == $_GET['tId']) {
$category = get_field('category_option_trips', 'trip_category_' . $_GET['tId']);
}
}
$argsTrip = array(
'post_type' => 'trip',
'posts_per_page' => -1
);
// query
$tripSelect = array();
$trip = new WP_Query($argsTrip);
if ($trip) {
while ($trip->have_posts()): $trip->the_post();
if (!empty($category)) {
我不明白,你在哪一页?post.php?edit.php我在编辑类别页面上,我有一个多选自定义字段,其中所有帖子都嵌入了ajax$(“#acf-field57B13A3E248AD”)。append($(“我不明白,你在哪一页?post.php?edit.php我在编辑类别页面上,我有一个多选自定义字段,其中所有帖子都嵌入了ajax$(“#acf-field57B13A3E248AD”).append($('
if (in_array(get_the_title(), $category)) {
$tripSelect[] = get_the_title() . '-selected';
} else {
$tripSelect[] = get_the_title();
}
} else {
$tripSelect[] = get_the_title();
}
endwhile;
}
}
echo json_encode($query);