Title: Plugin Configuration via Code Snippets
Last modified: August 30, 2022

---

# Plugin Configuration via Code Snippets

 *  Resolved [Pak Kriss](https://wordpress.org/support/users/pakkriss/)
 * (@pakkriss)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/plugin-configuration-via-code-snippets/)
 * Hi Pierre, great work your plugins. Thanks!
 * Regarding installation of the plugins we have an environment with over 100 websites
   leveraging the ManageWP platform.
 * E.g. so it’s simple for us to install & activate plugins across all websites 
   with a “single” process.
 * Regarding configuration or certain actions for plugins we leverage [https://managewp.com/guide/manage/code-snippets](https://managewp.com/guide/manage/code-snippets)
   to run plugin updates or configuration changes across all pages with a “single”
   process.
 * Example for Rocket WP:
 *     ```
       <?php 
   
       // Load WordPress environment.
       require 'wp-load.php';
   
       // Load WP Rocket environment.
       require 'wp-content/plugins/wp-rocket/wp-rocket.php';
       require 'wp-content/plugins/wp-rocket/inc/functions/htaccess.php';
   
       // Regenerate the htaccess file only on Apache.
       if ( function_exists( 'flush_rocket_htaccess' ) ) {
               flush_rocket_htaccess();
               echo 'The .htaccess file was regenerated.';
       }
       ```
   
 * Regarding your plugins it’s easy for us to install and activate them, but we 
   do not know or we need to know a similar code snippet to do the following actions:
 * /wp-admin/admin.php?page=apcm-settings
 * Object cache – Activate
    Garbage collector – Activate Analytics – Activate Admin
   notices -Activate
 * /wp-admin/admin.php?page=opcm-settings
 * Analytics – Activate
    Metrics – Activate Site invalidation – Never or other options
   Site warm-up – Deactivate Admin notices -Activate
 * Could you provide a code snipped similar to above example so we can configure
   your plugins?
 * Please let me know.
 * Best,
 * Pak Kriss

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Pierre Lannoy](https://wordpress.org/support/users/pierrelannoy/)
 * (@pierrelannoy)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/plugin-configuration-via-code-snippets/#post-15961960)
 * Hi [@pakkriss](https://wordpress.org/support/users/pakkriss/) !
 * And thanks for your kind words.
 * Unfortunately, there’s no such “php API” to configure settings from code. For
   now…
    I can develop such feature and it should be ready for WP 6.1 – but not 
   before. If you think it’s a good idea, please make a feature request on [https://github.com/Pierre-Lannoy/wp-apcu-manager/issues/new/choose](https://github.com/Pierre-Lannoy/wp-apcu-manager/issues/new/choose)
 * For now, the only way to configure some (not all) settings can be done via wp-
   cli (see [https://perfops.one/apcu-manager-wpcli/](https://perfops.one/apcu-manager-wpcli/)
   and [https://perfops.one/opcache-manager-wpcli/](https://perfops.one/opcache-manager-wpcli/)
   for examples). But it doesn’t cover all what you want to achieve.
    If you are
   ok for going with wp-cli (which is more consistent with the “WP way”), I can 
   implement the missing settings and it should be ready before the end of September.
   If you think wp-cli is a better way to do this, please make a feature request(
   to add missing settings) on [https://github.com/Pierre-Lannoy/wp-apcu-manager/issues/new/choose](https://github.com/Pierre-Lannoy/wp-apcu-manager/issues/new/choose)
 * Thank you
 *  Thread Starter [Pak Kriss](https://wordpress.org/support/users/pakkriss/)
 * (@pakkriss)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/plugin-configuration-via-code-snippets/#post-15965275)
 * Hello, Pierre, and thank you for your feedback.
 * wp-cli is generally good to go.
 * I’ll check with the current wp-cli options to see if this is okay.
 * If necessary, I’ll continue on github.
 * Thank you so much for your feedback.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin Configuration via Code Snippets’ is closed to new replies.

 * ![](https://ps.w.org/opcache-manager/assets/icon-256x256.png?rev=2197379)
 * [OPcache Manager](https://wordpress.org/plugins/opcache-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/opcache-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/opcache-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/opcache-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/opcache-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/opcache-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Pak Kriss](https://wordpress.org/support/users/pakkriss/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/plugin-configuration-via-code-snippets/#post-15965275)
 * Status: resolved