Support » Plugin: Contextual Related Posts » Disable on AMP

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ajay

    (@ajay)

    I haven’t tried this yet, but can you add this code to your theme’s functions.php to check. (you’ll ideally need to do this via an FTP after you’ve backed up the file)

    
    if ( function_exists( 'is_amp_endpoint' ) && true === is_amp_endpoint() ) {
      add_filter( 'get_crp_posts_id', '__return_false' ); 
      remove_action( 'template_redirect', 'crp_content_prepare_filter', 999 );
    }
    

    You will need to clear the cache via the settings page. You can try either add_filter or remove_action to see which one works

    Nope, unfortunately, it didn’t change anything 🙁

    Plugin Author Ajay

    (@ajay)

    Have you tried clearing / disabling the cache?

    
    add_filter( 'get_crp', '__return_false', 999 ); 
    

    Does the above work?

    I need it too, please.

    Plugin Author Ajay

    (@ajay)

    @kuma88, have you tried the above code and also cleared the cache?

    
    if ( function_exists( 'is_amp_endpoint' ) && true === is_amp_endpoint() ) {
         add_filter( 'get_crp', '__return_false', 999 ); 
    }
    
    Plugin Author Ajay

    (@ajay)

    Hi,

    I’ve been running tests on my site and I’m not sure why but I can’t get is_amp_endpoint to work when added to my functions.php

    I had to edit /includes/main-query.php and this soon after

    function get_crp_posts_id( $args = array() ) {
    
    if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
    return false;
    }
    
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable on AMP’ is closed to new replies.