Title: _make_cat_compat
Published: April 25, 2014
Last modified: April 28, 2025

---

# _make_cat_compat( array|object|WP_Term $category )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Updates category structure to old pre-2.3 from new taxonomy structure.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#description)󠁿

This function was added for the taxonomy support to update the new category structure
with the old category one. This will maintain compatibility with plugins and themes
which depend on the old key or property names.

The parameter should only be passed a variable and not create the array or object
inline to the parameter. The reason for this is that parameter is passed by reference
and PHP will fail unless it has the variable.

There is no return value, because everything is updated on the variable you pass
to it. This is one of the features with using pass by reference in PHP.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#parameters)󠁿

 `$category`array|object|[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)
required

Category row object or array.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#source)󠁿

    ```php
    function _make_cat_compat( &$category ) {
    	if ( is_object( $category ) && ! is_wp_error( $category ) ) {
    		$category->cat_ID               = $category->term_id;
    		$category->category_count       = $category->count;
    		$category->category_description = $category->description;
    		$category->cat_name             = $category->name;
    		$category->category_nicename    = $category->slug;
    		$category->category_parent      = $category->parent;
    	} elseif ( is_array( $category ) && isset( $category['term_id'] ) ) {
    		$category['cat_ID']               = &$category['term_id'];
    		$category['category_count']       = &$category['count'];
    		$category['category_description'] = &$category['description'];
    		$category['cat_name']             = &$category['name'];
    		$category['category_nicename']    = &$category['slug'];
    		$category['category_parent']      = &$category['parent'];
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/category.php#L378)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/category.php#L378-L394)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#related)󠁿

| Uses | Description | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

| Used by | Description | 
| [get_category_to_edit()](https://developer.wordpress.org/reference/functions/get_category_to_edit/)`wp-admin/includes/taxonomy.php` |

Gets category object for given ID and ‘edit’ filter context.

  | 
| [wp_update_category()](https://developer.wordpress.org/reference/functions/wp_update_category/)`wp-admin/includes/taxonomy.php` |

Aliases [wp_insert_category()](https://developer.wordpress.org/reference/functions/wp_insert_category/) with minimal args.

  | 
| [get_the_category()](https://developer.wordpress.org/reference/functions/get_the_category/)`wp-includes/category-template.php` |

Retrieves post categories.

  | 
| [WP_Query::get_queried_object()](https://developer.wordpress.org/reference/classes/wp_query/get_queried_object/)`wp-includes/class-wp-query.php` |

Retrieves the currently queried object.

  | 
| [get_categories()](https://developer.wordpress.org/reference/functions/get_categories/)`wp-includes/category.php` |

Retrieves a list of category objects.

  | 
| [get_category()](https://developer.wordpress.org/reference/functions/get_category/)`wp-includes/category.php` |

Retrieves category data given a category ID or category object.

  | 
| [get_category_by_path()](https://developer.wordpress.org/reference/functions/get_category_by_path/)`wp-includes/category.php` |

Retrieves a category based on URL containing the category slug.

  | 
| [get_category_by_slug()](https://developer.wordpress.org/reference/functions/get_category_by_slug/)`wp-includes/category.php` |

Retrieves a category object by category slug.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_make_cat_compat/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$category` parameter now also accepts a [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/) object. | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_make_cat_compat%2F)
before being able to contribute a note or feedback.