I applied a filter to remove all theme styles, but I want this to happen only if the url ends with /amp/.
The code below is removing the .css styles on all pages, not filtering the term /amp/ of the permalink.
I am using the AMP for Wordpress plugin, which adds /amp/ at the end of the URL. Examplo: mysite.com/category/post-slug/amp/
function remove_all_theme_styles() {
if ( get_permalink($post->ID) . '/amp/' ) {
global $wp_styles;
$wp_styles->queue = array();
}
}
add_action('wp_print_styles', 'remove_all_theme_styles', 100);
They said to add, but neither is working.
function remove_all_theme_styles() {
if ( $_SERVER['REQUEST_URI'] == get_permalink($post->ID) . '/amp/' ) {
/amp
? Please edit your question with the needed information – Tom J Nowell♦ Aug 28 '18 at 2:06