What I need: return all posts matching a search criteria:
In a Wordpress post, I have an ACF that accepts a shortcode like
[shortcode id="1234"]
Edit: In the wp_postmeta table, it is referenced like
post_id meta_key meta_value
5 _shortcode [shortcode id="1234"]
In the table that stores the shortcode data (wp_shortcode), it stores values that I need to search in this format below. One shortcode may contain multiple rows like below
id data
1234 {"sale_price":"1500000","bathroom":"1"}
1234 {"sale_price":"2000000","bathroom":"3"}
1234 {"sale_price":"3000000","bathroom":"5"}
When I do a search like
sale_price_from = 1000
sale_price_to = 2000000
bathroom = 3
The post id should return true if any row found in sale_price is between the sale_price_from and sale_price_to as well as if the bathroom as equal to 3. In this case, the search criteria is met by the second row in the wp_shortcode table so it should return the post that contains the shortcode.
If the search is like
sale_price_from = 1000
sale_price_to = 2000
bathroom = 3
Then it should not return the post as the sale_price_from and sale_price_to range isn't found in any of the rows in the wp_shorcode table.
I'm lost as I'm not sure how to access the wp_shortcode table data as it is stored in json format.