• Resolved j2021

    (@j2021)


    I’m looking at this documentation https://kb.theseoframework.com/kb/filter-reference-for-the-seo-framework/ and can’t found a single filter to programmatically change the canonical urls injected by TSF, is there a way to change it that way? So the reason is, I have way too many custom taxonomies & categories and manually changing it 1 by 1 is very time consuming, so I’m trying to find a way to automate it by changing it programmatically. Is there something I’m missing from the documentation? or this isn’t feasible at the moment?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Sorry for the belated reply.

    You’d have to adjust get_term_link()‘s output, which is what TSF uses.

    You can learn more about that function here: https://developer.ww.wp.xz.cn/reference/functions/get_term_link/.

    This is the filter you’re looking for:

    /**
     * Filters the term link.
     *
     * @since 2.5.0
     *
     * @param string  $termlink Term link URL.
     * @param WP_Term $term     Term object.
     * @param string  $taxonomy Taxonomy slug.
     */
    apply_filters( 'term_link', $termlink, $term, $taxonomy );

    Feel free to follow up if you’re finding issues. Cheers!

    Thread Starter j2021

    (@j2021)

    thanks, that works

    Thread Starter j2021

    (@j2021)

    thanks, that workssssss!!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘programmatically change canonical URLs injected’ is closed to new replies.