No support for ‘language_attributes’?
-
I have a ‘language_attributes’ filter that needs to check
amp_is_request().Before
calling amp_is_request(), I useif ( did_action( 'parse_query' ) )like so:$ret = false; if ( function_exists( 'amp_is_request' ) ) { if ( did_action( 'parse_query' ) ) { $ret = amp_is_request(); } }Unfortunately, I’m getting an
amp_is_available was called <strong>incorrectly</strong>error:amp_is_available was called incorrectly.
amp_is_available()(oramp_is_request(), formerlyis_amp_endpoint()) was called too early and so it will not work properly. WordPress is currently doing thelanguage_attributeshook. Calling this function before thewpaction means it will not have access toWP_Queryand the queried object to determine if it is an AMP response, thus neither theamp_skip_post()filter nor the AMP enabled toggle will be considered.If
did_action( 'parse_query' )is true, wouldn’t that mean the WP_Query has been parsed?js.
The topic ‘No support for ‘language_attributes’?’ is closed to new replies.