Power BI Embedded for WordPress gives you an easy way to embed reports, dashboards, or titles into WordPress content. However, this plugin doesn’t support protecting these valuable data by default.
Fortunately, thanks to the PPWP Pro plugin, you can achieve that with a few simple steps as below.
Requirements:
- Password Protect WordPress Lite plugin version 1.4.5 or greater
- Password Protect WordPress Pro plugin version 1.3.0 or greater
Step 1: Navigate to Password Protect WordPress >> General tab and select “Power BI Items” from Post Type Protection dropdown
Step 2: Password protect a Power BI Item
Step 3: Add the following code snippet into your (child) theme functions.php
add_filter( 'the_content', 'ppwp_integrate_powerbi', 999999 ); function ppwp_integrate_powerbi($content) { if ( is_singular( 'powerbi' ) ) { if ( post_password_required() ) { echo get_the_password_form(); // WPCS: XSS ok. return; } else { return $content; } } return $content; }