WordPress.org

Ready to get started?Download WordPress

Forums

Attachments
[resolved] Removing it from default post types: page and post (5 posts)

  1. charanjits
    Member
    Posted 1 year ago #

    I want to remove the Attachments from default post types: post and page. As I only want to add it to a custom post type that I have already created and added using the default example at https://github.com/jchristopher/attachments#create-custom-instances. Is there a way for doing that?

    http://wordpress.org/extend/plugins/attachments/

  2. Gianluca Cherubin
    Member
    Posted 1 year ago #

    Hi, change this part:

    // all post types to utilize (string|array)
        'post_type'     => array( 'post', 'page' ),

    to:

    // all post types to utilize (string|array)
        'post_type'     => array( 'YOUR CUSTOM POST TYPE' ),
  3. Jonathan Christopher
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you for helping with support, Gianluca Cherubin!

  4. charanjits
    Member
    Posted 1 year ago #

    Should I make this change in the plugin file or in my code? If its the later case then I tried using the code:
    'post_type' => array( 'my_cutom_post_type' ),

    But still I am able to see attachment section there under posts and pages.

    Isn't there any other of removing it from post and page via a hook/action?

  5. Jonathan Christopher
    Member
    Plugin Author

    Posted 1 year ago #

    You should never update the plugin code, just because it'll get overwritten every time the plugin updates.

    As per the docs, Attachments ships with a default instance that adds a Title and Caption field to Posts and Pages. If you'd like to disable the default instance, please check this out.

    That will remove the Attachments instance that's showing up on your Posts and Pages, it's then up to you to create a custom instance, making sure the post_type argument matches your Custom Post Type name.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic