Allowing post attachments without allowing to insert in text

Is there a way I can allow the user to attach images as attachments to a post without allowing him to insert them within the text itself? Ideally the Upload Media button remains the same but the image is not inserted within the text.

The reason is I don’t want users to start creating their own layouts and I want the template to always be consistent.

Read More

(I know there is a quick hack to just strip out tags in the content pages from the theme itself but that will just confuse my users, so I need a way to just attach images).

Related posts

Leave a Reply

2 comments

  1. One way to do this would be to simply hide the upload/insert media button: and, then add featured image support for your themes posts, so a user can still attach images to the post.

    Hide upload/insert media button for your theme in: functions.php:

    function hideUploadInsert($hook)
    {
        if($hook != 'post.php' AND $hook != 'post-new.php')
            return; // if not in the edit or new admin pages, for Posts or Pages, then do nothing.
        echo '<style type="text/css" media="screen">
            #wp-content-media-buttons {
                display: none;
            }
    </style>';
    }
    add_action('admin_enqueue_scripts', 'hideUploadInsert');
    

    Add featured image support to your themes posts in: functions.php

    add_theme_support('post-thumbnails', array( 'post' ));
    


    EDIT:

    I didn’t realize you were referring to attaching multiple images to a post. You could just use the css I gave above to hide the button for inserting images into a post: and, then use one of the plugins that come up in a google search for attaching multiple featured images to a post:
    https://www.google.ca/search?q=wordpress+multiple+featured+images

  2. Maybe the following works:

    add_filter( 'type_url_form_media', '__return_null' );
    

    Anyway: The function is already deprecated and the whole UI will likely be reworked with 3.5 or 3.6, so this solution might not work for too long.