How can I search the post title and tag using WP_query in wordpress?

user782104

I am currently implementing a search function to search the post from wordpress

I would like to search the post by Tag , by title and return it as JSON

I found a plugin that generates the result as JSON (JSON API)

http://wordpress.org/plugins/json-api/other_notes/#2.1.-Core-controller-methods

In that plugin , there is a get_posts function that can return the query that supports WP_query parameter

I tried a query like that

http://MyWordpressSite.com/?json=get_posts&status=published&orderby=date&order=DESC&lang=en&s=eng&tag=eng&cat=9,10,14,15

where the &s= is the keyword to search while the &tag= is the tag to search

However, there are two problems

  1. How can I limit the search to title only? http://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter

From the official website, it state search keyword ,but not limit to title only

  1. It seems the condition is tag "AND" keywords are match, but what I would like to achieve is tag "OR" keywords are match

http://codex.wordpress.org/Function_Reference/get_posts

So, to sum up , the goal is to search the post by Tag , by title and return it as JSON (actually is call the php through JSON), it doesnt matter using the plugin or not, any way achieve the goal is welcomed. Thanks for helping

rambu

I looked into plugin functions, This plugin does not support to get posts from multiple category. It just get one category by ID and return the posts and this category info. You need to make a custom plugin or try another to do this task.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to sanitize $_POST for wordpress WP_QUERY?

From Dev

How to create/modfiy WP_Query to search in post title OR custom field?

From Dev

WordPress: How do I get all posts from $wp_query in the search results?

From Dev

How can I use wp_query search for UK Postcodes with space and without space equally?

From Dev

How to set wp_query on search page in wordpress

From Dev

Wordpress WP_Query/get_posts where post_title equals returns all results

From Dev

How Can I Do LIMIT 1, 2 In WP_Query

From Dev

How can I order a wp_query with date and then time

From Dev

How can I dynamicly change the <title> tag?

From Dev

JSON using wp_Query in wordpress?

From Dev

search query for post title

From Dev

How to use post author ID to compare in WP_Query loop for WordPress

From Dev

Check for first post using wp_query

From Dev

WP_Query with “post_title LIKE 'something%'” and category

From Dev

how to order on post_IDs key not on value using WP_Query

From Dev

WP_Query to display posts by category in Wordpress (in custom post types)

From Dev

Wordpress : Custom order for custom post types on WP_Query

From Dev

Wordpress WP_Query get next post with same category

From Dev

variable as Post_type in wp_query - Wordpress

From Dev

I want to use post title as tag in wordpress. Is there anyway to automate the process instead of copy and paste one by one?

From Dev

How can I insert title of article in revolution slider in Wordpress

From Dev

How can I display images in Wordpress inbuilt the_title()?

From Dev

WordPress: search by Term, Post meta OR Post title together

From Dev

WooCommerce search products between price range using WP_Query

From Dev

How can I search for any meta tag where name starts with "ABC_" or "XYZ_" using jQuery

From Dev

How can I select all categories in WordPress using a MySQL query?

From Dev

How can I select all categories in WordPress using a MySQL query?

From Dev

Using WP_Query() to check if a post exists by slug

From Dev

ajax won't correctly pull post using wp_query

Related Related

  1. 1

    How to sanitize $_POST for wordpress WP_QUERY?

  2. 2

    How to create/modfiy WP_Query to search in post title OR custom field?

  3. 3

    WordPress: How do I get all posts from $wp_query in the search results?

  4. 4

    How can I use wp_query search for UK Postcodes with space and without space equally?

  5. 5

    How to set wp_query on search page in wordpress

  6. 6

    Wordpress WP_Query/get_posts where post_title equals returns all results

  7. 7

    How Can I Do LIMIT 1, 2 In WP_Query

  8. 8

    How can I order a wp_query with date and then time

  9. 9

    How can I dynamicly change the <title> tag?

  10. 10

    JSON using wp_Query in wordpress?

  11. 11

    search query for post title

  12. 12

    How to use post author ID to compare in WP_Query loop for WordPress

  13. 13

    Check for first post using wp_query

  14. 14

    WP_Query with “post_title LIKE 'something%'” and category

  15. 15

    how to order on post_IDs key not on value using WP_Query

  16. 16

    WP_Query to display posts by category in Wordpress (in custom post types)

  17. 17

    Wordpress : Custom order for custom post types on WP_Query

  18. 18

    Wordpress WP_Query get next post with same category

  19. 19

    variable as Post_type in wp_query - Wordpress

  20. 20

    I want to use post title as tag in wordpress. Is there anyway to automate the process instead of copy and paste one by one?

  21. 21

    How can I insert title of article in revolution slider in Wordpress

  22. 22

    How can I display images in Wordpress inbuilt the_title()?

  23. 23

    WordPress: search by Term, Post meta OR Post title together

  24. 24

    WooCommerce search products between price range using WP_Query

  25. 25

    How can I search for any meta tag where name starts with "ABC_" or "XYZ_" using jQuery

  26. 26

    How can I select all categories in WordPress using a MySQL query?

  27. 27

    How can I select all categories in WordPress using a MySQL query?

  28. 28

    Using WP_Query() to check if a post exists by slug

  29. 29

    ajax won't correctly pull post using wp_query

HotTag

Archive