Force url ?amp=1
-
I need help to force all the AMP links to always use “?amp=1” instead of “/amp”.
I’m using for the filter below to accomplish it for <link rel=”amphtml”> in posts and pages (the code works) but in I’m homepage the <link rel=”amphtml”> and the link in the header of AMP pages the link uses “/amp”.
I already saved the Permalinks but it doesen’t works.
add_filter( 'amp_pre_get_permalink', 'my_amp_force_querystring_permalink', 10, 2 ); function my_amp_force_querystring_permalink( $permalink, $post_id ) { return add_query_arg( AMP_QUERY_VAR, 1, get_permalink( $post_id ) ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Force url ?amp=1’ is closed to new replies.