WP Residence Help WP Residence Help

  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / 24. Technical how to | Custom Code Required / Technical: How to Add a new taxonomy

Technical: How to Add a new taxonomy

1659 views 0

WPResidence registers its custom post types and default property taxonomies from the WPResidence Core plugin (for example: wpresidence-core/post-types/property.php). For that reason, any custom taxonomy you add should be placed in a child theme (or a small custom plugin), not in the parent theme files.

1) Add the code in your child theme

Add the snippet below to Appearance → Theme File Editor → (your child theme) → functions.php or via FTP in your child theme’s functions.php

<?php
/**
 * Register a custom taxonomy for WPResidence.
 * Tested with WPResidence 5.4.1+
 */
add_action( ‘init’, ‘wpresidence_register_property_custom_taxonomy’, 30 );
if ( ! function_exists( ‘wpresidence_register_property_custom_taxonomy’ ) ) {
function wpresidence_register_property_custom_taxonomy() {
$labels = array(
‘name’              => esc_html__( ‘Custom Categories’, ‘wpresidence-core’ ),
‘singular_name’     => esc_html__( ‘Custom Category’, ‘wpresidence-core’ ),
‘search_items’      => esc_html__( ‘Search Custom Categories’, ‘wpresidence-core’ ),
‘all_items’         => esc_html__( ‘All Custom Categories’, ‘wpresidence-core’ ),
‘parent_item’       => esc_html__( ‘Parent Custom Category’, ‘wpresidence-core’ ),
‘parent_item_colon’ => esc_html__( ‘Parent Custom Category:’, ‘wpresidence-core’ ),
‘edit_item’         => esc_html__( ‘Edit Custom Category’, ‘wpresidence-core’ ),
‘update_item’       => esc_html__( ‘Update Custom Category’, ‘wpresidence-core’ ),
‘add_new_item’      => esc_html__( ‘Add New Custom Category’, ‘wpresidence-core’ ),
‘new_item_name’     => esc_html__( ‘New Custom Category Name’, ‘wpresidence-core’ ),
‘menu_name’         => esc_html__( ‘Custom Categories’, ‘wpresidence-core’ ),
);
register_taxonomy(
‘property_custom_category’,              // 1) Taxonomy name (must be unique)
array( ‘estate_property’ ),              // 2) Attach to WPResidence post type
array(
‘labels’            => $labels,
‘hierarchical’      => true,
‘public’            => true,
‘show_ui’           => true,
‘show_admin_column’ => true,
‘query_var’         => true,
‘show_in_rest’      => true,          // Gutenberg/REST support
‘rewrite’           => array(
‘slug’         => ‘custom_category’,
‘with_front’   => false,
‘hierarchical’ => true,
),
)
);
}
}

Notes:

  • estate_property is the WPResidence Property custom post type.

  • If you want to attach the taxonomy to other WPResidence content types, you can swap the object type array:

    • Properties: estate_property

    • Agents: estate_agent

    • Agencies: estate_agency

    • Developers: estate_developer

(WordPress taxonomy registration reference)

2) Flush permalinks (important)

After adding the code, go to Settings → Permalinks and click Save Changes once. This flushes rewrite rules so your new taxonomy URLs work.

3) Add taxonomy terms

After that, you’ll be able to add terms for your new taxonomy from the WordPress admin (it will appear in the relevant admin menus once registered).

Important limitation (theme-specific)

Registering the taxonomy makes it available in WordPress (admin + URLs). If you also want that taxonomy to appear inside WPResidence-specific UI like advanced search builders, custom list filters, or special theme modules, that typically needs extra theme integration code (because those areas use their own internal field lists).

 

24. Technical how to | Custom Code Required

Related Articles

  • Technical: Change the Schedule Tour Email Text and the Form Default Message
  • Property list filter customization
  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization

WP Residence Documentation

  • 01. Getting Started
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 02. Installation & Setup
  • 03. Installation FAQ
  • 06. Search & Filtering
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 09. Agent, Agency & Developers
  • 08. Property Pages & Layouts
  • 07. Property Lists, Categories & Archive
  • 13. WPResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • 04. Theme Options & Global Settings
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • 20. Translations & Languages
  • 26. FAQ
  • 10. Pages
  • 11. Header
  • 12. Footer
  • 05. Maps & Location Settings
  • 18. Payments & Monetization
  • Plugins
    • 19. Included Plugins
    • 22. Third Party Plugins – IDX Compatibility
    • 21. Third-Party Plugins – Multi-Language
    • 23. Third party Plugins – Other
  • Technical
    • 24. Technical how to | Custom Code Required
    • 25. Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API