Support » Plugin: Slim SEO - Fast & Automated WordPress SEO Plugin » Filter hooks and manual fields priority

  • Resolved yankiara

    (@yankiara)


    Hi,
    When I use slim_seo_meta_title filter, I can’t override a title using the meta fields box.
    I think manual fields should always have priority over filters.
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tran Ngoc Tuan Anh

    (@rilwis)

    Hi @yankiara ,

    It’s a common practice that WordPress hooks (actions, filters) have the highest priority because that way developers can control things with code. It’s the same in Slim SEO. In this case, you can check with code to see if it has manual meta title and bypass if it presents.

    Thread Starter yankiara

    (@yankiara)

    OK, thank you. I’ll do that.

    Thread Starter yankiara

    (@yankiara)

    For those interested, this code works:

    
    add_filter( 'slim_seo_meta_title', function( $title ) {
        
        $slim_meta = get_post_meta( get_the_ID(), 'slim_seo' );
        if ( $slim_meta && $slim_meta[0]['title']  )
            return $slim_meta[0]['title'];
    
        /* YOUR STUFF */
    
    } );
    

    Might be added to documentation?

    Plugin Author Tran Ngoc Tuan Anh

    (@rilwis)

    Thanks for your suggestion. The docs is now updated!

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