Thread Starter
ziegel
(@ziegel)
I have generated a solution according to the first above link.
- Create a MU-PLUGIN in the folder: wp-content/mu-plugins of the name active-plugins.php
<?php
/**
* @package active-plugins
* @version 1.0
*
* Plugin Name: Active Plugins
* Plugin URI: http://wordpress.org/extend/plugins/#
* Description: This is a development plugin
* Author: Example
* Version: 1.0
* Author URI: https://example.com/
*/
// shortcode to list active plugins
add_shortcode( 'activeplugins', function(){
$active_plugins = get_option( 'active_plugins' );
$plugins = "";
if( count( $active_plugins ) > 0 ){
$plugins = "<ul>";
foreach ( $active_plugins as $plugin ) {
$plugins .= "<li>" . $plugin . "</li>";
}
$plugins .= "</ul>";
}
return $plugins;
});
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$is_admin = strpos( $request_uri, '/wp-admin/' );
if( false === $is_admin ){
add_filter( 'option_active_plugins', function( $plugins ){
global $request_uri;
$is_regs_form = strpos( $request_uri, '/registration-form/' );
$is_tran_form = strpos( $request_uri, '/transaction-form/' );
$is_auth_form = strpos( $request_uri, '/signature-form/' );
$myplugins = array(
"contact-form-7-signature-addon/signature.php" ,
"contact-form-cfdb7/contact-form-cfdb-7.php" ,
"cf7-conditional-fields/contact-form-7-conditional-fields.php"
);
if( (false === $is_regs_form) && (false === $is_tran_form) && (false === $is_auth_form ) ){
$plugins = array_diff( $plugins, $myplugins );
}
return $plugins;
} );
}
- Then via ACF create a text field of different names for each form page (theme).
- Go to the WordPress pages of the forms and in the newly created separate fields (different name for each form) add the short code snippet:
[activeplugins]
- Clear cache, and test to see when you upload a form page, that under browser INSPECTION -> Networks (refresh when you switch to Networks), you can see an element with the name beginning with sign*…
- Resources are not seen on other pages.
Thread Starter
ziegel
(@ziegel)
This technique only seemed to work for me. Some functions.php tasks stopped working.
There’s a Freesoul plugin that lets you global disable plugins and then allow them on certain posts etc. I use it.