Support » Plugin: The SEO Framework » Disable Primary Category

  • Resolved bidiesman

    (@bidiesman)


    Hello,
    I’m using your plugin with woocommerce. I’m very happy about its features and speed: simple and efficient!

    I recently discovered that when creating new products and choosing some category.
    your plugin features: ‘primary category’ is always choosing the parent category as default. For example:

    if my product is a shoe and my category is:
    Shoes->For Men->city->leather
    your plugin will choose as default if nothing is ticked:
    Shoes
    and woocommerce would display
    Shoes->For Men->city->leather
    if your plugin is deactivated. which is way more efficient.

    In a first time,
    -is it possible to deactivate this feature from your plugin’s setting as soon?

    I have 5000 products and most of them are redirecting to a very parent category. So customer can’t smartly use breadcrumb to go one step above and have a look to all “city” shoes.

    and for a later version, why not to:
    have an option in order to force your plugin to choose:
    -the deepest category path by default
    -if there is 2 category path, then take the longuest path.
    for example:
    for a same shoe you have the two following categories:

    Shoes->For Men->city->leather
    and also
    Shoes->For Men->outdoor

    then choose by default: Shoes->For Men->city->leather
    because it is the most specific.

    if it’s 2 category at same level, then the first one of the two.

    Looking forward hearing from you.

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

    (@cybr)

    Hi Jé,

    For older posts/products created before activating TSF, when no primary term has been set for them, it should default to the primary term selected by WordPress/WooCommerce. By default, this is the term that has the lowest term ID. When you edit such a post/product, TSF will automatically assign and select that term as primary.

    When you create a post or product, TSF automatically selects a primary term based on the first term you’ve assigned to the post. When you unassign a term that’s primary, TSF will look for an assigned term with the lowest term ID.

    I don’t believe adjusting its lookup logic would improve things for most of our users. Let me explain.

    The feature would sometimes select the first term you’ve activated, and sometimes it’ll look for a hierarchically deeper term. Even if this was optional, where users would have to consciously activate it (I’d bet less than 1% would do), this can ultimately become confusing and frustrating.

    To learn why, please refer to this WCAG documentation on accessibility.

    Unexpected changes of context can be so disorienting for users with visual disabilities or cognitive limitations that they are unable to use the content. […] Some individuals with low vision, with reading and intellectual disabilities, and others who have difficulty interpreting visual cues may benefit from additional cues in order to detect changes of context.

    Do we want to add visual and spoken cues after a term is selected that invokes a change of primary term? How should we even execute that? What happens when the first term selected is the most favorable one, whereafter it erratically changes to another one later? I often ponder for dozens of hours on any single feature, and sometimes they make it in the plugin, and at other times, no one would’ve known I even considered it. Sometimes, it takes years for me to implement a feature because I couldn’t find the correct way to implement it earlier. Perhaps, this will be one of them.

    We need to maintain a shallow entry for ease-of-use; the simpler we make it, the more you can use the plugin on “auto-pilot”, whether you have disabilities or not: Repeated patterns, clean interface, instant feedback, no new things to learn, etc. all contribute to this. It is also why I keep TSF so much in line with WordPress’s interface, even when I don’t agree with everything it brings. The stance I take is very much in line with the first five proclamations of WordPress’s philosophy.

    With all that, I believe it’s best to stick with the “first selected/lowest ID” logic, and allow the user to select the primary term manually via the selector TSF provides thereafter.

    If deactivating TSF yields different results for your primary term selection, then another plugin or theme may be adjusting the breadcrumbs, whereafter TSF overrides that behavior. So, if you wish to deactivate the primary term feature from TSF, you’ll have to implement this snippet — feel free to exclude some of the remove_filter-calls to make it more suitable for your scenario:

    add_action( 'the_seo_framework_after_init', function() {
    
    	$tsf = the_seo_framework();
    
    	// Remove post permalink primary term support.
    	remove_filter( 'post_link_category', [ $tsf, '_adjust_post_link_category' ], 10 );
    
    	// Remove product permalink primary term support.
    	remove_filter( 'wc_product_post_type_link_product_cat', [ $tsf, '_adjust_post_link_category' ], 10 );
    	// Remove product breadcrumb primary term support.
    	remove_filter( 'woocommerce_breadcrumb_main_term', [ $tsf, '_adjust_post_link_category' ], 10 );
    	// Remove product category widget primary term support.
    	remove_filter( 'woocommerce_product_categories_widget_main_term', [ $tsf, '_adjust_post_link_category' ], 10 );
    } );

    Feature requests tend to get lost into the void of these forums real quickly. So, if you have any more feature requests, please forward them directly to GitHub: https://tsf.fyi/support/feature. Thanks!

    Thread Starter bidiesman

    (@bidiesman)

    Hi Sybre,
    thanks a lot for this detailed answer and sorry for my late answer./

    We are using wpallimport.com plugin and woocommerce advanced bulk edit from wpmelon to edit/add/duplicate new products. We can’t get your feature working in it and/or having it choosing the longuest category path by default. but when disabling your plugin it seems to behave like I wish.
    but I don’t wish to disable your plugin 😉

    I try as much as possible to avoid custom filter in function.php and I rather launch a chat with the plugin developer in order to propose and find a solution.

    I will definitely use your remove_filter listed. And as I told you, if you make it a checkbox option in the futureI will for sure do it. And I will have a closer look to your new features on each update (we never know 😉 )

    Kind regards,

    Thread Starter bidiesman

    (@bidiesman)

    ps:I just add your snippet but bullet point are still visible:

    add_action( 'the_seo_framework_after_init', function() {
    
    	$tsf = the_seo_framework();
    
    	// Remove post permalink primary term support.
    	remove_filter( 'post_link_category', [ $tsf, '_adjust_post_link_category' ], 10 );
    
    	// Remove product permalink primary term support.
    	remove_filter( 'wc_product_post_type_link_product_cat', [ $tsf, '_adjust_post_link_category' ], 10 );
    	// Remove product breadcrumb primary term support.
    	remove_filter( 'woocommerce_breadcrumb_main_term', [ $tsf, '_adjust_post_link_category' ], 10 );
    	// Remove product category widget primary term support.
    	remove_filter( 'woocommerce_product_categories_widget_main_term', [ $tsf, '_adjust_post_link_category' ], 10 );
    } );

    any idea what could be wrong?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Jé!

    The snippet doesn’t remove the styling, nor does it affect how TSF uses or stores the primary term to sort its integrated breadcrumbs. We can’t change that, because it’s hardcoded.

    That’s why I opted to leave the styling in place, although I considered removing them via the snippet I supplied (here’s the filter). Moreover, it’s not easy to do either, I unfortunately discovered, because there’s support for multidimensional arrays. Besides, there’s no toggle for removing support for primary terms, so I’m uncertain which repercussions removing the scripts may bring–either now or in the future.

    I’m very much on the same line as you with fixing the cause rather than addressing the affected via filters and whatnot. Nevertheless, if you wish to have such a toggle embedded in the plugin, please forward a feature request to our GitHub repo. Depending on how much traction it gets, we’ll consider implementation moving forward.

    I hope this clears things up for now 🙂 Have a great day!

    Thread Starter bidiesman

    (@bidiesman)

    Hey Sybre,
    I’m not really sure I’m understanding correctly:
    snippet you provided above will still display category checkbox. but will not save data anymore is that correct?
    and if I want to remove the visual then I have to use the filter (following your supplied link)?

    Did I correctly submit the request on the Github?
    https://github.com/sybrew/the-seo-framework/pull/562

    To be honest, I really don’t want to switch to any other heavy seo plugin. I’d love to keep using your plugin and being able to deactivate with a simple tickbox this Primary Category feature.

    Thanks!

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Jé,

    The snippet will remove the Primary Term functionality of TSF from WooCommerce and WordPress. The filter names should indicate wherefore each filter is: wc/woocommerce-prefixed is for WooCommerce, the other one is for WordPress.

    The SEO Framework will still process storing the primary term values and use them for its breadcrumb-script output. But, since TSF doesn’t output breadcrumbs on WooCommerce pages — and lets WooCommerce handle those, instead — you should find no issues with the primary term feature with the snippet implemented.

    If you want to remove the checkboxes — which I do not recommend because of the complexity — then you can use the filter I linked to earlier.

    I hope this clarifies everything!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable Primary Category’ is closed to new replies.