0
此標題查詢不起作用,其中帖子標題在標題前有特殊字符。我檢查他的職位。例如:-Y-WordPress帖子標題查詢不能使用特殊字符
這裏是代碼的後單頁模板:
<?php
$get_s_value = $_GET['search'];
if ($get_s_value == 'true') {
$current_p_title = get_the_title();
$args = array (
'post_type' => 'trending',
'post_status' => 'publish',
"s" => $current_p_title,
);
query_posts($args);
if (have_posts()): the_post();
$sahifa_trending_count = get_post_meta(get_the_ID(), '_trending_count', 1);
$update_count = $sahifa_trending_count + 1;
$last_m_date = get_the_modified_date('Y-m-d');
$trending_c_date = date('Y-m-d');
if ($last_m_date = $trending_c_date) {
update_metadata('post', get_the_ID(), '_trending_count', $update_count);
} else {
update_metadata('post', get_the_ID(), '_trending_count', '1');
}
else:
$create_post = array (
'post_type' => 'trending',
'post_title' => get_the_title(),
'post_status' => 'publish',
'meta_input' => array (
'_trending_count' => '1',
),
);
wp_insert_post($create_post);
endif;
wp_reset_query();
}