AI Verified

Name

Categories for Pages

About

Add "Categories" taxonomy to Pages (as it is default for "Posts" already).

Language

PHP

Rating

Voted: 2 by 2 user(s)

Codevault

deckerweb

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

21/02/2024

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Categories for Pages

 
                    
1add_action( 'init', 'add_categories_to_pages' );
2 /*
3 * Add CATEGORIES to pages
4 */
5function add_categories_to_pages() {
6 
7 register_taxonomy_for_object_type( 'category', 'page' );
8 
9}

2

Featured Snippet

Comments

  • DT

    1 year ago

    Excellent! Still have no idea why this isn't a native part of WP!
  • ML
    M L

    11 months ago

    Thank you so much for this code. You are a life-saver.
    I spent hours trying to figure out a solution, then saw a video from Imran at Websquadron https://www.youtube.com/@websquadron/videos that led me here (I always find his videos useful). Within minutes, my pages were categorized. Again, thanks for turning WP into what it should be by default.
    

Related Snippets

Please see some snippets below related to this snippet..

General

AI Verified

0

Hide Login Errors in WordPress

Added: 8 months ago

Last Updated: 8 months ago

General

AI Verified

1

Add content after a menu in mobile version (bricks builder)

Added: 1 year ago

Last Updated: 11 months ago

Add content after wordpress defaut menu in mobile version (here)

General

AI Verified

1

Smooth scroll for GeneratePress anchor links

Added: 1 year ago

Last Updated: 1 year ago

If you're having problems with 'smooth scroll' while using GeneratePress this PHP snippet will sort it out! It will make it smooth instead of just 'jumping' to the anchor link destination

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

AI Verified

2

Categories for Pages

Added: 1 year ago

Last Updated: 4 months ago

Add "Categories" taxonomy to Pages (as it is default for "Posts" already).