• Resolved jibem

    (@jibem)


    Hi,
    A big thank you for you work, great plugin !!!

    However, I have a security problem with the page bfd_download/, is it possible to block it ?
    This webpage is accessible to everyone and lists all my files … while my files are on wordpress password protected pages.
    How can I desactivate the bfd_download/ page ?

    Thank you !

    (while waiting for your answer, I made a redirect 301 on htaccess :))

    • This topic was modified 5 years, 6 months ago by jibem.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,
    Ditto this one, It will be a dealbreaker for me that this security should be by default part of the plugin.
    Thank you

    Hi, you can add the following to your child theme’s functions.php.
    This worked for me.

    function tsum_download_custom_post_type_args( $args, $post_type ) {
        if ( $post_type == "bfd_download" ) {
            $args = array(
           	'has_archive'        => false,
           	'publicly_queryable'  => true,
    	'hierarchical'          => false,
            );
        }
        return $args;
    }
    add_filter( 'register_post_type_args', 'tsum_download_custom_post_type_args', 20, 2 );

    My solution above also hides Downloads in the wp admin.
    So I reverted to:

    add_action(
        'template_redirect',
        function () {
           // if (is_singular('bfd_download')) {
           if (is_post_type_archive('bfd_download')) {
               global $wp_query;
               $wp_query->posts = [];
               $wp_query->post = null;
               $wp_query->set_404();
               status_header(404);
               nocache_headers();
            }
        }
    );
    Thread Starter jibem

    (@jibem)

    Hi @schalkjoubert , a big thank for your answer ! Work great !

    I would appreciate having a feedback from the developer ?? ?

    Plugin Author ndhaddon

    (@ndhaddon)

    Hi,

    I’m glad you guys got it worked out ??

    Cheers,

    Nik

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to block bfd_download/ ?’ is closed to new replies.