Roots Discourse

How to add a Pro Plugin to Bedrock?

If I need to use a pro plugin which is probably not available at wordpress packagist, should I add it to my local server like regular plugins? How it will be added to my live site? Also should I exclude it in .gitignore if I my repo is “Puplic”? Any suggestions?

Many use https://github.com/cedaro/satispress for this purpose.

Edit: See my post below.

1 Like

Thanks It seems promising.

another approach (works for me)

To elaborate on the above- I also personally use SatisPress for maintaining my private plugins after previously managing them on GitHub manually.

More or less, I make a super composer.json on the Bedrock of my SatisPress and use this method where necessary along with including private packages that have an in-house Composer repo just to keep everything in 1 place:

{
  "type": "package",
  "package": {
    "name": "advanced-custom-fields/advanced-custom-fields-pro",
    "version": "5.8.7",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k={%ACF_PRO_KEY}&t={%version}"
    },
    "require": {
      "composer/installers": "^1.7",
      "ffraenz/private-composer-installer": "^3.0"
    }
  }
},
{
  "type": "package",
  "package": {
    "name": "admin-columns/admin-columns-pro",
    "version": "4.7.3",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://www.admincolumns.com/?command=download&subscription_key={%AC_PRO_KEY}&product_key=admin-columns-pro&version={%version}"
    },
    "require": {
      "composer/installers": "^1.7",
      "ffraenz/private-composer-installer": "^3.0"
    }
  }
},
{
  "type": "package",
  "package": {
    "name": "admin-columns/ac-addon-acf",
    "version": "2.5.5",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://www.admincolumns.com/?command=download&subscription_key={%AC_PRO_KEY}&product_key=ac-addon-acf&version={%version}"
    },
    "require": {
      "composer/installers": "^1.7",
      "ffraenz/private-composer-installer": "^3.0"
    }
  }
},
{
  "type": "package",
  "package": {
    "name": "related-posts/related-posts-premium",
    "version": "1.9.0",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://www.relatedpostsforwp.com/?download_api_product=72&license_key={%RP4WP_KEY}&activation_email={%RP4WP_EMAIL}"
    },
    "require": {
      "composer/installers": "^1.7",
      "ffraenz/private-composer-installer": "^3.0"
    }
  }
},

It is deployed with Trellis and runs a blank theme with a style.css, an empty index.php, and a functions.php with the following contents:

<?php

add_filter('auto_update_plugin', '__return_true');
add_filter('auto_update_theme', '__return_true');

add_filter('template_redirect', function () {
    if (
        (defined('DOING_AJAX') && DOING_AJAX) || 
        (defined('DOING_CRON') && DOING_CRON) || 
        (defined('WP_CLI') && WP_CLI) ||
        is_user_logged_in()
    ) {
        return;
    }

    if (wp_safe_redirect(wp_login_url(), 302)) {
        exit;
    }
});

This has since worked quite well. I believe the only plugin to give me trouble was WordPress SEO Premium and it was solved with a simple Trellis hook in build-after.yml:

- name: Install WordPress SEO Premium Composer dependencies
  composer:
    no_scripts: yes
    no_dev: yes
    working_dir: "{{ deploy_helper.new_release_path }}/web/app/plugins/wordpress-seo-premium"
4 Likes