Disabling “Custom URL” or “File Upload” Options in Document Library Pro Plugin

How to Disable “Custom URL” or “File Upload” Options in Document Library Pro Plugin

If you’re using the Document Library Pro (DLP) plugin by Barn2 and want to customize the document creation process by hiding the “Custom URL” or “File Upload” options, you’re in the right place. Follow these easy steps to achieve the desired result.

Step 1: Modify Your Child Theme’s Functions file

To begin, you need to add a small piece of code to your child theme’s functions. Open your child theme’s functions.php file.

Step 2: Insert the Code

Copy and paste the following code into the functions.php file:

function hide_dlp_document_options() {
    $screen = get_current_screen();
    if ( $screen->id === 'dlp_document' ) {
        // Hide the "Custom URL" option
        echo '<style>#dlp_document_link_type option[value="url"]{display:none;}</style>';

        // OR hide the "File Upload" option
        // echo '<style>#dlp_document_link_type option[value="file"]{display:none;}</style>';
    }
}
add_action( 'admin_head', 'hide_dlp_document_options' );

Step 3: Save the Changes

Save the functions.php file, and you’re all set. Now, either the “Custom URL” or “File Upload” option will be hidden based on the code you chose to include.

Remember, if you want to hide the “Custom URL” option, use the first line inside the function. If you prefer to hide the “File Upload” option, use the second line. You can choose one or the other, depending on your specific requirements.

That’s it! You’ve successfully customized the document creation options in Document Library Pro. If you have any questions or need further assistance, feel free to reach out.

Happy customizing!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top