How to query posts by month based on date custom field?
-
30-10-2019 - |
Pergunta
I currently created a custom field for a custom post type that stores a date in the format dd/mm/yyyy is there a way to query the posts by the month?
I "kind of" got the functionality I need using the following query:
query_posts('post_type=attraction&meta_key=attraction_date&meta_value=10&meta_compare=LIKE');
The meta_value
parameter would be the month but since I'm using LIKE
to compare if I have a date like 10/04/2011 it'd be returned even though it's not from october.
I know there's a RLIKE
expression in MySQL that lets you use regex for the LIKE
condition but I'm not sure if wordpress lets you use it in any way.
Thanks in advance!
Nenhuma solução correta
Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange