0

I want to search some posts which contain characters **awk -v **in my wordpress.

1.to search it with mysql select command.

select guid,post_title  from wp_posts where post_content like  '%awk%-v%';
+-----------------------------+---------------------------------------+
| guid                        | post_title                            |
+-----------------------------+---------------------------------------+
| http://hwy.local/wp/?p=3323 | 文本处理工具awk                       |
| http://hwy.local/wp/?p=3330 | 格式化a链接:添加属性和值             |
| http://hwy.local/wp/?p=3339 | 文本处理工具awk                       |
+-----------------------------+---------------------------------------+
3 rows in set (0.06 sec)

enter image description here

2.to search it in search posts.

enter image description here

Why the two search results are totally different?
It is verified that all the search results in search posts form are wrong ,all the the search results with sql command are right.
Why the search results are wrong in search posts form? All the four search results searched in search posts form opened ,none of them contain characters both awk and -v.

0

You can use the_search_query() to look at the last search query run by WordPress. https://codex.wordpress.org/Function_Reference/the_search_query

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.