【发布时间】:2017-07-06 19:40:55
【问题描述】:
此标题查询不起作用,其中帖子标题在标题前有一个特殊字符。我检查了他的标题。例如:-y-
这里是帖子单页模板的代码:
<?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();
}
【问题讨论】:
标签: wordpress