wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

WordPress link button does not recognize primary category permalink

Open rmarcano opened this issue 8 years ago • 16 comments

What did you expect to happen?

WordPress to insert link using the primary category permalink.

What happened instead?

WordPress inserts the link using the categories in alphabetical order instead of the primary category permalink.

How can we reproduce this behavior?

  1. Configure the permalinks as /%category%/%postname%/
  2. Create new categories: category01, category02, category03
  3. Create a new post, assign category03 as primary category, this would make the URL /category03/postname.

category-permalink

  1. In another post, insert a link using the WordPress link button. linktool

  2. Check that WordPress suggests the /category01/ link instead of the /category03/ permalink. linktool02

Technical info

  • WordPress version: 4.7.5
  • Yoast SEO version: 4.8

rmarcano avatar Jun 05 '17 19:06 rmarcano

Please inform the customer of conversation # 200046 when this conversation has been closed.

rmarcano avatar Jun 06 '17 15:06 rmarcano

This user in the free forum is experiencing the same issue https://wordpress.org/support/topic/primary-category-function-not-working-correctly/

monbauza avatar Jun 27 '17 06:06 monbauza

Related https://wordpress.org/support/topic/problem-with-categories-yoast/

monbauza avatar Aug 01 '17 08:08 monbauza

The user here also experiencing this issue: https://wordpress.org/support/topic/primary-taxonomy-not-reflected-in-url/

mmikhan avatar Jun 28 '18 17:06 mmikhan

Same issue. Any solutions?

flacon2000 avatar Aug 29 '19 18:08 flacon2000

This issue still happens in Yoast SEO v14.5 but only when a link is added using the Classic Editor, not Gutenberg.

monbauza avatar Jul 15 '20 06:07 monbauza

Please inform the customer of conversation # 630299 when this conversation has been closed.

monbauza avatar Jul 15 '20 06:07 monbauza

This issue also happens with Yoast SEO Premium v15.0. I would've thought getting the right URL showing with an SEO plugin is a little more important than "trivial"! :)

Devon-Developer avatar Oct 15 '20 13:10 Devon-Developer

Please inform the customer of conversation # 728038 when this conversation has been closed.

josh-yoast avatar Apr 27 '21 14:04 josh-yoast

Still reproducible with Yoast SEO 18.6 and Classic Editor 1.6.2. It seems that not always the first category in alphabetical order is chosen. In my tests, when a post link is inserted, the Classic Editor includes the original category (the first category that was assigned to the post) in the permalink instead of the primary category.

monbauza avatar Apr 27 '22 07:04 monbauza

Please inform the customer of conversation # 884845 when this conversation has been closed.

monbauza avatar Apr 27 '22 07:04 monbauza

The issue moved to internal issue management board. I can confirm the issue is no longer only specific to the Classic Editor but occurs on Gutenberg editor as well.

mmikhan avatar May 06 '22 21:05 mmikhan

Issue still reproducible in Yoast SEO 20.5 and Classic Editor 1.6.3. Re-opening.

monbauza avatar Apr 12 '23 10:04 monbauza

can't wait for this to be fixed! makes us second guess using yoast primary category with our URLs

timatron avatar Aug 25 '23 18:08 timatron

Please inform the customer of conversation # 1069404 when this conversation has been closed.

suascat avatar Oct 27 '23 08:10 suascat

Please inform the customer of conversation # 1112593 when this conversation has been closed.

suascat avatar Mar 08 '24 11:03 suascat

Initial investigation:

  • It seems that we can hook into the search behaviour with add_action( 'wp_ajax_wp_link_ajax',. We can investigate if we can make sure to include the primary term in the link instead of another term.

thijsoo avatar Aug 05 '24 11:08 thijsoo