Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Lane

    (@laned69)

    I’ll second this.

    I am also getting the same error on two different websites. Debug log shows it started with the last plugin update to 5.1.7.

    Here is my workaround.

    I typed the word “todays_date” in the Meta Value field in the Post Meta Query section of the AQL block settings. Then I added the following code in my theme’s functions.php file. It basically looks at what has been typed in, and if it is “todays_date”, then it changes it to the numerical date by using the date() function.

    function change_query_date_value( $query_args, $block_query, $inherited ) {
    	if ( isset( $query_args['meta_query'] ) && ! empty( $query_args['meta_query'] ) ) {
    		
    		if ( $query_args['meta_query'][0]['value'] == 'todays_date' ) { $query_args['meta_query'][0]['value'] = date('Ymd'); }
    	
    	}
    	return $query_args;
    }
    add_filter( 'aql_query_vars', 'change_query_date_value', 10, 3 );
    Thread Starter Lane

    (@laned69)

    I discovered two problems for me: neither the ACF meta_key nor the meta_value were being inserted into the query.

    It appears that ACF is not registering the custom fields as post meta. I had to write a simple function to do that. Perhaps you might not have this problem.

    I am fine with that but the next part is kinda ugly. I added one line of code to the AQL plugin file query-loop.php. This is not ideal or recommended as any updates to the plugin may overwrite, requiring the line of code to be re-added or no longer work. Inside the foreach loop on line 23 I added:

    if ( $query['meta_value'] == "todays_date" ) { $query['meta_value'] = date( 'Ymd' ); };

    Then, in the query loop block settings I put “todays_date” as the meta_value.

    This works, but is not “proper”. And I’m sure the plugin author will have a much better way to do it.

    UPDATE: After updating to 1.4.1, I re-added same line of code and it still works.

Viewing 3 replies - 1 through 3 (of 3 total)