Skip to content

justinblayney/custom-primary-category

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom Primary Category for Permalinks

Allows manual selection of a primary category to use in post permalinks (replaces %category%).

Disclaimer

This plugin is provided "as is" without warranty of any kind, either expressed or implied. Use at your own risk. The author is not responsible for any damage or loss of data that may occur through the use of this plugin.

By using this plugin, you agree to these terms.

Description

Custom Primary Category for Permalinks gives you full control over which category appears in a post’s permalink—especially useful when a post is assigned to multiple categories. By default, WordPress may choose a category that isn’t ideal for SEO. This plugin lets you manually select a "primary" category, ensuring your permalinks stay clean, relevant, and optimized for search engines.

Includes fallback behavior and is compatible with standard permalink structures using %category%.

Installation

  1. Upload the plugin to your WordPress site or install it through the WordPress plugin directory.
  2. Activate the plugin.
  3. Edit a post with multiple categories. You’ll see a Primary Category dropdown in the sidebar (below Categories or Publish depending on your setup).
  4. Choose your preferred primary category.
  5. Save, update, or schedule the post for the changes to take effect.

Current Limitations

  • The primary category list only updates when the post is saved or scheduled. It does not automatically reflect category changes in real time.
  • Permalink preview does not dynamically update in the editor when switching the primary category, but the saved permalink will be correct.
  • Gutenberg and Divi compatibility has not been fully tested.

Planned Improvements

  • Dynamically update the primary category selector when categories are added or removed from the post.
  • Dynamically update the permalink preview in real time when selecting a new primary category.
  • Full compatibility testing for Gutenberg and Divi editors.

License

GPLv2 or later
https://www.gnu.org/licenses/gpl-2.0.html

Author

Justin Blayney
https://www.darkstarmedia.net

About

Allows manual selection of a primary category to use in post permalinks (replaces %category%).

Resources

License

Stars

Watchers

Forks

Packages

No packages published