• Resolved bcmagnino

    (@bcmagnino)


    Choosing a category-based expiration setting (like Category: Replace) for a custom post type is not working via the Classic Editor for post types with multiple hierarchical taxonomies. (I have not tested whether this affects built-in post types with multiple taxonomies.) Choosing a category-based option displays the following error in the Post Expirator metabox:

    “More than 1 heirachical taxonomy detected. You must assign a default taxonomy on the settings screen.”

    This appears to be due to default options not being instantiated correctly in /views/classic-metabox.php (referenced on lines 139 and 146). Because those default options are not found, the default taxonomy from the settings page is not selected.

    For anyone who encounters this problem and needs an immediate fix, here is a potential (and temporary) solution if you have the ability to edit plugin files. Note that any edits you make to a plugin file will be overwritten next time you update the plugin.

    In the /post-expirator/views/classic-metabox.php file, add a new, uniquely-named variable on its own line immediately below line 133:

    $uniquely_prefixed_defaults = get_option( 'expirationdateDefaults' . ucfirst( $post->post_type ) );

    Then, on lines 140 and 147, replace all instances of $defaults[‘taxonomy’] with $uniquely_prefixed_defaults[‘taxonomy’]

    Those changes should allow Post Expirator’s Classic Editor metabox to display your default settings without interfering with anything else.

    I see that similar issues have been reported, but I wanted to make you aware of this specific problem. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Category-based expiration not working for custom post types in classic editor’ is closed to new replies.