Title: Bug &#8211; Incorrect category on quick edit post
Last modified: May 9, 2018

---

# Bug – Incorrect category on quick edit post

 *  Resolved [dtszero](https://wordpress.org/support/users/dtszero/)
 * (@dtszero)
 * [8 years ago](https://wordpress.org/support/topic/bug-incorrect-category-on-quick-edit-post/)
 * Hi,
 * I have a custom permalink config
    `mysite.com/%category%/%postname%/`
 * And I choose a principal category using the Yoast Plugin. With this I using a
   custom action for the new’s publish/updates of my post’s and send a notification
   to my social profiles.
 *     ```
       add_action( 'transition_post_status', 'notifications', 10, 3 );
       function notifications ( $new_status, $old_status, $post ) {
         if ( get_post_type($post->ID) !== 'post' ) { $send = false; } else { $send = true; }
         $url = get_the_permalink($post->ID);
       }
       ```
   
 *  […]
 * But, I receive an “incorrect” permalink config when I using the quick edit post
   function.
 * If I use the normal post editor the permalink that I return is
    `mysite.com/vacations/
   china`
 * But if I use the quick edit the permalink is wrong:
    `mysite.com/travels/asia`
 * The principal category that I choose disappears and is sending the WordPress 
   default alphabetic category as a base.
 * _Yoast Version: 7.4.2
    WordPress Version: 4.9.5 PHP Version: 7.0

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

 *  [Md Mazedul Islam Khan](https://wordpress.org/support/users/mazedulislamkhan/)
 * (@mazedulislamkhan)
 * [8 years ago](https://wordpress.org/support/topic/bug-incorrect-category-on-quick-edit-post/#post-10267434)
 * We can’t offer support on custom code (needed to change (core) features of our
   plugin). Since we don’t want to take the risk that we break your website by suggesting
   incorrect or incomplete code, we cannot advise you on how to make such changes.
   Maybe someone watching these forums can assist you further, but if your topic
   is inactive for 7 days, we’ll mark it as resolved to keep the overview.
 * Thank you for your understanding.
 *  Thread Starter [dtszero](https://wordpress.org/support/users/dtszero/)
 * (@dtszero)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/bug-incorrect-category-on-quick-edit-post/#post-10311389)
 * Thanks for the reply 🙂
 * I looked into you core examples of github and I found a manual code for check
   this:
 *     ```
       // SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
       function patch_primary_cat($id){
         $category = get_the_category($id);
         $useCatLink = true;
       	if ($category){
       		$category_link = '';
       		if ( class_exists('WPSEO_Primary_Term') ){
       			// Show the post's 'Primary' category, if this Yoast feature is available, & one is set
       			$wpseo_primary_term = new WPSEO_Primary_Term( 'category', $id );
       			$wpseo_primary_term = $wpseo_primary_term->get_primary_term();
       			$term = get_term( $wpseo_primary_term );
       			if (!is_wp_error($term)) {
       			  // Yoast Primary category
       			  $category_link = get_category_link( $term->term_id );
       			  return $category_link;
       			}
       		}
       	}
       }
       ```
   
 * I’m not sure if isn’t pretty but is working for me. Thanks!

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

The topic ‘Bug – Incorrect category on quick edit post’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

## Tags

 * [permalinks](https://wordpress.org/support/topic-tag/permalinks/)

 * 2 replies
 * 2 participants
 * Last reply from: [dtszero](https://wordpress.org/support/users/dtszero/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/bug-incorrect-category-on-quick-edit-post/#post-10311389)
 * Status: resolved