• Resolved yessoftmk

    (@yessoftmk)


    Hi, I need some customisation for canonical_url…

    I add code to m function php:

    
    

    add_filter(‘aioseo_canonical_url’,’remove_canonical_url’, 10, 1);
    function remove_canonical_url( $url ){
    //global $post;

    return “sasas”;
    //try return false;

    }`

    `

    but it not work, canonical still exist….

    can y please help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support shivamtyagi

    (@shivamtyagi)

    Hi @yessoftmk, I’ve made some changes to the snippet you mentioned. Can you please try using the code snippet below and let me know if that works for you?

    add_filter('aioseo_canonical_url','remove_canonical_url', 10, 1);
    function remove_canonical_url( $url ){
    //global $post;
    return '';
    //try return false;
    }

    If the problem persists, can you please check if you’re using another SEO plugin on your site that could be creating its own canonical URL tag?

    Thread Starter yessoftmk

    (@yessoftmk)

    yes, work, super

    thx )

    Hi,

    i want to use this function too. However, I would like the canonical to be removed if a value is stored there.

    Unfortunately, this function only works if the canonical field on the page or post is empty.

    Best Jens

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.