Skip to content

mc_set_primary_category

github-actions[bot] edited this page Jun 3, 2026 · 4 revisions

Filter primary category decision. Primary category is normally the alphabetically first listed category or the first selected private category.

Auto-generated Example

add_filter(
   'mc_set_primary_category',
    function(
        int $primary,
        array $cats,
        array $post
    ) {
        // Your code here.
        return $primary;
    },
    10,
    3
);

Parameters

  • int $primary Primary category ID.
  • array $cats All selected categories.
  • array $post Submitted query.

Returns

int

Files

apply_filters( 'mc_set_primary_category', $primary, $cats, $post )

← All Hooks

Clone this wiki locally