Co-Authors Plus
[resolved] Restrict to certain content types (3 posts)

  1. HarroH
    Posted 3 years ago #

    Hi Guys,

    First of all, awesome plugin. Been using it a lot in websites. However, I'm going to use it for another website now that requires some modifications.

    What I'm looking for it to restrict the plugin to only show at certain content types. I now see the box in every content type, but I want to restrict it to one or two custom content types I already have. Is there an easy way to do this or to give me some direction on where to start?

    Thanks in advance.


  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 3 years ago #

    There's not an easy way to do this right now, unfortunately :( I've filed an issue to make it easier.

    Until then, you can probably use something like this:

    add_action( 'add_meta_boxes', 'capx_remove_metabox_for_post_type', 5 );
    function capx_remove_metabox_for_post_type() {
    	global $coauthors_plus;
    	if ( in_array( get_post_type(), array( 'page' ) ) ) {
    		remove_action( 'add_meta_boxes', array( $coauthors_plus, 'add_coauthors_box' ) );
    		remove_action( 'add_meta_boxes', array( $coauthors_plus, 'remove_authors_box' ) );

    I haven't tested it fully though.

  3. HarroH
    Posted 3 years ago #

    Hi Daniel,

    It would be very nice if the check would be before actually adding the box, so hopefully next version perhaps ;).

    But this did the trick for now, thanks! Keep up the good work.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic