### Install Git Updater using WP-CLI Source: https://git-updater.com/knowledge-base/installation_seq_no=2 Install and activate the Git Updater plugin directly from a GitHub archive URL using the WP-CLI command-line tool. This method is efficient for quick installations and activations. ```bash wp plugin install --activate https://github.com/afragen/git-updater/archive/master.zip ``` -------------------------------- ### Exclude Freemius Autoload for Non-Standard WP Installations with Composer Source: https://git-updater.com/knowledge-base/installation This configuration snippet is added to the `composer.json` file to exclude the Freemius autoload file (`start.php`) when using non-standard WordPress installations like Bedrock or Roots. This prevents potential conflicts while still allowing Freemius functionality, as the `start.php` file is loaded explicitly by the `GU_Freemius` class. ```json { "require-dev": { "mcaskill/composer-exclude-files": "^4.0" }, "extra": { "exclude-from-files": [ "freemius/wordpress-sdk/start.php" ] } } ``` -------------------------------- ### Install Git Updater using Composer Source: https://git-updater.com/knowledge-base/installation_seq_no=2 Configure your project's `composer.json` to include Git Updater as a dependency. This method allows for version management and custom installation paths within your WordPress structure. It requires the `composer/installers` package for handling plugin and theme installations. ```json { "require": { "afragen/git-updater": "^12", "composer/installers": "^1" }, "minimum-stability": "dev", "repositories": [ { "type": "vcs", "url": "https://github.com/afragen/git-updater" } ], "extra": { "installer-paths": { "wp-content/plugins/{$name}/": [ "type:wordpress-plugin" ], "wp-content/themes/{$name}/": [ "type:wordpress-theme" ] } } } ``` -------------------------------- ### Exclude Freemius Autoload for Non-Standard WP Installations (Composer) Source: https://git-updater.com/knowledge-base/installation_seq_no=2 For Bedrock, Roots, or other non-standard WordPress installations, this `composer.json` modification excludes the Freemius autoload file (`start.php`) to prevent potential conflicts. It requires the `mcaskill/composer-exclude-files` dev dependency. ```json "require-dev": { "mcaskill/composer-exclude-files": "^4.0" }, "extra": { "exclude-from-files": [ "freemius/wordpress-sdk/start.php" ] }, ``` -------------------------------- ### Plugin Directory Structure Example Source: https://git-updater.com/knowledge-base/usage Recommended directory structure for a Git Updater compatible plugin repository. The main plugin file must be in the root directory with supporting files like readme.txt and README.md. Subdirectories contain additional plugin assets and functionality. ```text ├── good-plugin.php ├── readme.txt ├── README.md ├── CHANGES.md ├── includes | ├── ... | └── queries.php ├── ... └── ... ``` -------------------------------- ### Install Git Updater Lite with Composer and Initialize Source: https://git-updater.com/knowledge-base/git-updater-lite Install the Git Updater Lite package using Composer and add initialization code to your plugin's main file or theme's functions.php. This code requires the Composer autoloader, sets up a filter for the update server URI, and instantiates the Git_Updater\Lite class. Replace the placeholder URI with your actual update server endpoint. ```php require_once __DIR__ . '/vendor/autoload.php'; add_filter( 'gul_update_server', function () { return ''; }); ( new \Fragen\Git_Updater\Lite( __FILE__ ) )->run(); ``` -------------------------------- ### Create Symlink for Must Use Plugin (Windows) Source: https://git-updater.com/knowledge-base/installation_seq_no=2 Manually create a symbolic link for the Git Updater loader file (`gu-loader.php`) into the `mu-plugins` directory on Windows Vista, 7, or 8 using the `mklink` command. This installs Git Updater as a must-use plugin, ensuring automatic updates and preventing deactivation. ```batch cd /D mklink wp-content\mu-plugins\gu-loader.php wp-content\plugins\git-updater\mu\gu-loader.php ``` -------------------------------- ### Create Symlink for Must Use Plugin (Linux) Source: https://git-updater.com/knowledge-base/installation_seq_no=2 Manually create a symbolic link for the Git Updater loader file (`gu-loader.php`) into the `mu-plugins` directory on a Linux system. This method installs Git Updater as a must-use plugin, ensuring it's always active and cannot be deactivated. ```bash cd ln -sv wp-content/plugins/git-updater/mu/gu-loader.php wp-content/mu-plugins ``` -------------------------------- ### Install Plugins/Themes from Git Repositories Source: https://git-updater.com/knowledge-base/wp-cli-support This command allows installing plugins or themes directly from a Git repository URI. Optional parameters enable specifying a branch, providing an access token for private repositories, or indicating the Git hosting service (GitHub, Bitbucket, GitLab, Gitea, Gist). ```bash wp plugin install-git [--branch=] [--github] [--bitbucket] [--gitlab] wp theme install-git [--branch=] [--github] [--bitbucket] [--gitlab] ``` -------------------------------- ### Install Theme from Private Bitbucket Repository Source: https://git-updater.com/knowledge-base/wp-cli-support This command installs a theme directly from a private Bitbucket repository. It requires providing the repository URI and using the `--token` option with the Bitbucket username and password. ```bash wp theme install-git https://bitbucket.org/my-username/my-theme --token=username:password ``` -------------------------------- ### Install and Activate Git Updater Plugin Source: https://git-updater.com/knowledge-base/wp-cli-support This command installs the Git Updater plugin from a ZIP archive hosted on GitHub and activates it. This is a standard way to install plugins via WP-CLI when not using a package manager. ```bash wp plugin install https://github.com/afragen/git-updater/archive/master.zip --activate ``` -------------------------------- ### Bitbucket Pipeline for Theme Release Automation Source: https://git-updater.com/knowledge-base/user-build-processes This Bitbucket pipeline automates the creation of release assets when the `style.css` file in a theme is updated. It handles dependency installation (Composer, Node.js), builds assets, zips the release, and uploads it using the `atlassian/bitbucket-upload-file` pipe. It requires environment variables like `$GITHUB_ACCESS_TOKEN`, `$APP_USERNAME`, and `$APP_PASSWORD` for authentication and access. ```yaml # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: php:7.1.29 pipelines: branches: # Execute change detection only on master branch 'master': - step: image: atlassian/default-image:2 # Run change detection script (requires git command) script: - ./changedetected.sh tags: # Build and upload release asset each time a new tag is pushed '*.*.*': - step: caches: - composer - node script: # Setup Environment - apt-get update && apt-get install -y unzip zip - curl -sL https://deb.nodesource.com/setup_13.x | bash - - apt-get install -y nodejs - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install node and composer dependencies - composer config -g github-oauth.github.com $GITHUB_ACCESS_TOKEN - composer install --prefer-dist - npm install # Build all script and style assets (if you use a node based build toolchain) - npm run build # Zip and upload new release (replace directories to zip with your own) - zip -r -q release/$BITBUCKET_REPO_SLUG-$BITBUCKET_TAG.zip *.php assets/ fonts/ languages/ inc/ page-templates/ views/ vendor/ style.css screenshot.jpg - pipe: atlassian/bitbucket-upload-file:0.1.2 variables: BITBUCKET_USERNAME: $APP_USERNAME BITBUCKET_APP_PASSWORD: $APP_PASSWORD FILENAME: 'release/$BITBUCKET_REPO_SLUG-$BITBUCKET_TAG.zip' ``` -------------------------------- ### Switch Branches for Installed Plugins/Themes Source: https://git-updater.com/knowledge-base/wp-cli-support This command allows switching an installed plugin or theme to a different branch within its repository. The `` refers to the repository's folder name, and `` specifies the target branch. ```bash wp plugin branch-switch wp theme branch-switch ``` -------------------------------- ### Get Help for Git Updater WP-CLI Subcommands Source: https://git-updater.com/knowledge-base/wp-cli-support These commands display help information for the Git Updater subcommands available under `wp plugin` and `wp theme`. They are useful for understanding the available options and syntax. ```bash wp plugin install-git --help wp theme install-git --help wp plugin branch-switch --help wp theme branch-switch --help ``` -------------------------------- ### Define Freemius Activation Constants in wp-config.php Source: https://git-updater.com/knowledge-base/wp-cli-installation-activation-of-git-updater-pro This code snippet demonstrates how to define constants in the wp-config.php file for Freemius activation, specifically for the 'gup_fs' shortcode and the Git Updater PRO license key. This is typically needed if only using the Freemius Auto Activation plugin. ```php // freemius activation define( 'FS_SHORTCODES', array( 'gup_fs' ) ); define( 'WP__GUP_FS__LICENSE_KEY', '' ); ``` -------------------------------- ### Example Git Updater REST API Endpoint URL Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints This is the base URL for the Git Updater REST API, used for updating plugins and themes. The 'key' parameter is essential for authentication and is auto-generated by the plugin. ```plaintext http://localhost/wp-json/git-updater/v1/update/?key=76bb2b7c819c36ee37292b6978a4ad61 ``` -------------------------------- ### Configure Bitbucket Theme Addition Source: https://git-updater.com/knowledge-base/git-updater-additions Configuration example for adding a Bitbucket-hosted theme without Git Updater headers to Git Updater. The slug for themes uses only the stylesheet slug without file path, differing from plugin configuration. ```yaml type: bitbucket_theme slug: theme-noheader uri: https://bitbucket.org/afragen/theme-noheader ``` -------------------------------- ### Plugin Header Declaration with Git Updater URI Source: https://git-updater.com/knowledge-base/usage Standard plugin header file demonstrating required metadata and GitHub Plugin URI declaration for Git Updater integration. This header must be placed in the main plugin file and includes plugin name, description, version, author, and GitHub repository reference. The GitHub Plugin URI is mandatory for automatic updates. ```php /** * Plugin Name: Git Updater * Plugin URI: https://github.com/afragen/git-updater * Description: A plugin to automatically update GitHub, Bitbucket or GitLab hosted plugins and themes. It also allows for remote installation of plugins or themes into WordPress. * Version: 10.0.0 * Author: Andy Fragen * License: MIT * Domain Path: /languages * Text Domain: git-updater * GitHub Plugin URI: https://github.com/afragen/git-updater * GitHub Languages: https://github.com/afragen/git-updater-translations */ ``` -------------------------------- ### Configure GitHub Plugin Addition Source: https://git-updater.com/knowledge-base/git-updater-additions Configuration example for adding a GitHub-hosted plugin without Git Updater headers to Git Updater. The slug must include the plugin file path relative to the plugins directory. The type identifies the hosting platform and content type. ```yaml type: github_plugin slug: plugin-noheader/plugin-noheader.php uri: https://github.com/afragen/plugin-noheader ``` -------------------------------- ### Theme Header Declaration with Git Updater URI Source: https://git-updater.com/knowledge-base/usage Standard theme header file for style.css demonstrating required metadata and GitHub Theme URI declaration for Git Updater integration. This header must be placed in the root style.css file and includes theme name, version, description, and GitHub repository reference. The GitHub Theme URI is mandatory for automatic updates. ```css /** * Theme Name: Test * Theme URI: http://thefragens.net/ * Version: 0.1.0 * Description: Child theme of TwentyTwelve. * Author: Andy Fragen * Template: twentytwelve * Template Version: 1.0.0 * GitHub Theme URI: https://github.com/afragen/test-child */ ``` -------------------------------- ### GitHub Enterprise URI Configuration for Git Updater Source: https://git-updater.com/knowledge-base/self-hosted-enterprise-git-hosts Configures the GitHub Plugin URI or GitHub Theme URI header for self-hosted GitHub Enterprise installations. Requires the full URI including owner and repository. Authentication via personal access token or repository-dependent access token is mandatory. ```php GitHub Plugin URI: https://github.yourhost.com// ``` -------------------------------- ### GET /wp-json/git-updater/v1/update-api Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Retrieves update information for a plugin or theme, similar to WordPress's `plugins_api()` or `themes_api()`. This can be used for a custom update server. ```APIDOC ## GET /wp-json/git-updater/v1/update-api ### Description This endpoint returns data comparable to WordPress's `plugins_api()` or `themes_api()` functions. It is designed to serve current update information via a REST endpoint, suitable for custom update servers. Requires Git Updater and the referenced plugin/theme to be installed and configured correctly. ### Method GET ### Endpoint `/wp-json/git-updater/v1/update-api/` ### Parameters #### Query Parameters - **slug** (string) - Required - The repository slug for the plugin or theme. ### Request Example ``` https://localhost/wp-json/git-updater/v1/update-api/?slug=my-repo ``` ### Response #### Success Response (200) Returns an object containing update data for the specified plugin or theme. #### Response Example ```json { "name": "My Plugin", "slug": "my-plugin", "version": "1.2.3", "last_updated": "2023-10-27 10:00:00", "download_link": "https://example.com/downloads/my-plugin.zip" } ``` ``` -------------------------------- ### GET /wp-json/git-updater/v1/flush-repo-cache Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Flushes the cache for an individual repository. The data will be repopulated via APIs on the next page load. ```APIDOC ## GET /wp-json/git-updater/v1/flush-repo-cache ### Description This endpoint flushes the cache for a specific repository. Upon the next page load, the data associated with that repository will be repopulated by fetching it through the relevant APIs. ### Method GET ### Endpoint `/wp-json/git-updater/v1/flush-repo-cache/` ### Parameters #### Query Parameters - **slug** (string) - Required - The repository slug for the plugin or theme whose cache should be flushed. ### Request Example ``` https://localhost/wp-json/git-updater/v1/flush-repo-cache/?slug=my-repo ``` ### Response #### Success Response (200) Indicates that the repository cache has been successfully flushed. Specific response body details may vary. #### Response Example ```json { "success": true, "message": "Cache flushed successfully for my-repo." } ``` ``` -------------------------------- ### Bitbucket Server URI Configuration for Git Updater (Individual) Source: https://git-updater.com/knowledge-base/self-hosted-enterprise-git-hosts Details the Bitbucket Plugin URI format for individual user repositories on Bitbucket Server v5 or greater. User repositories require a '~' prefix before the owner. Authentication with Bitbucket Server username/password is mandatory. ```php Bitbucket Plugin URI: https://bitbucket.example.com/~/ ``` -------------------------------- ### Enable Freemius Debug Mode in WordPress Source: https://git-updater.com/knowledge-base/troubleshooting This code snippet enables the Freemius Debug Menu in the WordPress admin dashboard by defining a constant in the wp-config.php file. This menu is useful for debugging license activation and premium plugin update issues related to Freemius. ```php define( 'WP_FS__DEV_MODE', true ); ``` -------------------------------- ### Filter Remote Version Check in Git Updater (PHP) Source: https://git-updater.com/knowledge-base/developer-hooks The `gu_remote_is_newer` filter hook allows modification of the logic that determines if a remote repository version is newer than the currently installed one. It passes the `$newer` boolean and the `$repo` identifier. The hook should return a boolean value. No external dependencies are required beyond the Git Updater plugin. ```php add_filter( 'gu_remote_is_newer', function( $newer, $repo ) { return $newer; }, 10, 2 ); ``` -------------------------------- ### Add Bitbucket Credentials via WP-CLI Source: https://git-updater.com/knowledge-base/wp-cli-support This demonstrates how to set up credentials for accessing private Bitbucket repositories using WP-CLI. It involves updating a site option with the Bitbucket username and app password. ```bash wp site option update git_updater '{"bitbucket_access_token":"my-username:my-password"}' --format=json ``` -------------------------------- ### Define Freemius Clone Resolution Constants in PHP Source: https://git-updater.com/knowledge-base/freemius-clone-resolution Set Freemius clone resolution constants to specify how duplicate site instances should be handled. Three options are available: temporary_duplicate for testing/staging/development purposes, new_home to migrate license activation to the new site, and long_term_duplicate to auto-activate the license on the new cloned site. Add these constants to wp-config.php or functions.php. ```php // A temporary duplication for the purpose of testing, staging, or development. define( 'FS__RESOLVE_CLONE_AS', 'temporary_duplicate' ); // The new site is replacing the old one – this will migrate the license activation to the new site to resolve the clone. define( 'FS__RESOLVE_CLONE_AS', 'new_home' ); // The cloned site is a new and different one – this will auto activate the license on the new site to resolve the clone. define( 'FS__RESOLVE_CLONE_AS', 'long_term_duplicate' ); ``` -------------------------------- ### Interact with Git Updater Plugin Core Commands Source: https://git-updater.com/knowledge-base/wp-cli-support These are the main commands for interacting with the Git Updater plugin itself. They allow for cache management and resetting the plugin's API key. ```bash wp git-updater wp git-updater cache wp git-updater reset-api-key ``` -------------------------------- ### Basic API Call to Git Updater (No Update Specified) Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Demonstrates a simple `curl` request to the Git Updater REST API without specifying a plugin or theme for update. This will result in an error message indicating that an update target is required. ```bash $ curl "http://localhost/wp-json/git-updater/v1/update/?key=76bb2b7c819c36ee37292b6978a4ad61" { "message": "No plugin or theme specified for update.", "success": false } ``` -------------------------------- ### Bash Script for CSS Version Change Detection and Git Tagging Source: https://git-updater.com/knowledge-base/user-build-processes This bash script detects changes in the `style.css` file within a Git repository. If changes are found and a new version number is present in the file, it checks if a Git tag for that version already exists. If not, it creates a new annotated tag with the version number and pushes it to the remote repository, which can trigger subsequent build processes. ```bash #!/bin/bash revcount=$(git rev-list --all --count) if [ "$revcount" -gt 1 ] then histdiff=$(git diff --name-only HEAD HEAD~1 | grep 'style.css') if [ "$histdiff" = "style.css" ] then version=$(grep "Version:" style.css | cut -d ':' -f 2 | xargs) if git rev-parse "$version" >/dev/null 2>&1 then echo "Tag already exists; no action taken" else echo "Creating new tag ${version}" changeref=$(git rev-parse HEAD) git tag -a ${version} ${changeref} -m "Release version ${version}" git push origin --tags fi else echo "style.css not changed" fi else echo "History too short" fi ``` -------------------------------- ### Specify ZipFile URL for Rollback Package (PHP) Source: https://git-updater.com/knowledge-base/developer-hooks The 'gu_post_construct_download_link' filter hook enables developers to specify a direct ZipFile URL for use as a rollback package. It receives the repository details and rollback tag, returning the desired download link. ```php add_filter( 'gu_post_construct_download_link', function( $download_link, $repo, $rollback_tag ) { // Example: return a custom URL based on repo and tag return "https://example.com/downloads/{$repo->slug}-{$rollback_tag}.zip"; }, 10, 3 ); ``` -------------------------------- ### Set Options for Private Repositories (PHP) Source: https://git-updater.com/knowledge-base/developer-hooks The 'gu_set_options' hook allows developers to provide access tokens and specify repository details for private themes or plugins. The anonymous function must return key/value pairs where the key is the option name or repository slug and the value is the token or branch information. This is useful for distributing private software without client interaction. ```php add_filter( 'gu_set_options', function( $options ) { return array_merge( $options, [ 'my-repo-slug' => 'my-repo-slug_access_token', 'my-other-repo-slug' => 'my-repo-slug_pseudo_token', 'current_branch_my-repo-slug' => 'master', ] ); }); ``` -------------------------------- ### Instantiate Ignore class for plugins and themes in Git Updater Source: https://git-updater.com/knowledge-base/how-to-ignore-repositories-in-git-updater Create instances of the Fragen\Git_Updater\Ignore class to exclude repositories from Git Updater API checks. Pass the repository slug and the main plugin/theme file path. For plugins, use the plugin slug and plugin.php file; for themes, use the theme slug and style.css file. ```php new Fragen\Git_Updater\Ignore( 'test-plugin', 'test-plugin/test-plugin.php' ); new Fragen\Git_Updater\Ignore( 'test-child', 'test-child/style.css' ); ``` -------------------------------- ### Update API Endpoint for Plugin/Theme Data Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Fetches data similar to WordPress's `plugins_api()` or `themes_api()` via a REST endpoint. This endpoint is useful for update servers. Requires the repository slug. ```HTTP https://localhost/wp-json/git-updater/v1/update-api/?slug=my-repo ``` -------------------------------- ### POST /wp-json/git-updater/v1/update Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints This endpoint allows for the remote update of WordPress plugins or themes. You must provide an authentication key and specify either a plugin or a theme to update. ```APIDOC ## POST /wp-json/git-updater/v1/update ### Description This endpoint facilitates the remote updating of WordPress plugins or themes. It requires an authentication key and the slug of the plugin or theme to be updated. ### Method POST ### Endpoint `/wp-json/git-updater/v1/update/` ### Parameters #### Query Parameters - **key** (string) - Required - The authentication key generated by the Git Updater plugin. - **plugin** (string) - Optional - The slug of the plugin to update. - **theme** (string) - Optional - The slug of the theme to update. - **committish** (string) - Optional - Specifies a particular tag, branch, or commit for the update. Defaults to 'master'. - **tag** (string) - Optional - An alias for the `committish` attribute. - **branch** (string) - Optional - Specify a specific branch for updating. - **override** (boolean) - Optional - Use when the current branch and requested branch differ. ### Request Example ```bash curl "http://localhost/wp-json/git-updater/v1/update/?key=76bb2b7c819c36ee37292b6978a4ad61&plugin=mickesplugin" ``` ### Response #### Success Response (200) - **messages** (array) - An array of strings detailing the update process. - **success** (boolean) - True if the update was successful, false otherwise. #### Response Example ```json { "messages": [ "Downloading update from https:\/\/api.github.com\/repos\/limikael\/mickesplugin\/zipball\/master<\/span>…", "Unpacking the update…", "Installing the latest version…", "Removing the old version of the plugin…", "Plugin updated successfully." ], "success": true } ``` #### Error Response (e.g., 400 Bad Request) ```json { "message": "No plugin or theme specified for update.", "success": false } ``` ``` -------------------------------- ### Update API Endpoint Source: https://git-updater.com/knowledge-base/git-updater-lite This endpoint provides a JSON response containing update information for a given plugin or theme slug, compatible with WordPress's `plugins_api()` or `themes_api()` functions. The data is cached for 6 hours. ```APIDOC ## GET /wp-json/git-updater/v1/update-api/ ### Description Retrieves update information for a specific plugin or theme. ### Method GET ### Endpoint `/wp-json/git-updater/v1/update-api/` ### Parameters #### Query Parameters - **slug** (string) - Required - The slug of the plugin or theme for which to retrieve update information. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **slug** (string) - The slug of the plugin or theme. - **version** (string) - The latest available version. - **source_archive** (string) - The URL to the plugin or theme archive. - **source_checkout** (string) - The URL to the repository checkout. - **has_update** (boolean) - Indicates if an update is available. - **last_checked** (integer) - Timestamp of the last cache check. #### Response Example ```json { "slug": "my-plugin", "version": "1.2.0", "source_archive": "https://github.com/user/my-plugin/archive/refs/tags/v1.2.0.zip", "source_checkout": "https://github.com/user/my-plugin", "has_update": true, "last_checked": 1672100000 } ``` ``` -------------------------------- ### Bitbucket Server URI Configuration for Git Updater (Group) Source: https://git-updater.com/knowledge-base/self-hosted-enterprise-git-hosts Provides the Bitbucket Plugin URI format for group repositories on Bitbucket Server v5 or greater. Authentication with Bitbucket Server username/password is required as all repositories are private. ```php Bitbucket Plugin URI: https://bitbucket.example.com// ``` -------------------------------- ### GitLab CE/Enterprise URI Configuration for Git Updater Source: https://git-updater.com/knowledge-base/self-hosted-enterprise-git-hosts Specifies the GitLab Plugin URI or GitLab Theme URI header for self-hosted GitLab CE/Enterprise. The URI should include the owner and repository. Authentication is required using a personal access token or a repository-dependent access token. ```php GitLab Plugin URI: https://gitlab.yourhost.com// ``` -------------------------------- ### Force Background Processing via Browser Source: https://git-updater.com/knowledge-base/background-processing Triggers background processing by directly accessing the WP-Cron script through a web browser. Ensure to replace 'mysite.com' with your actual domain. ```html http://mysite.com/wp-cron.php ``` -------------------------------- ### Force Background Processing with WP-CLI Source: https://git-updater.com/knowledge-base/background-processing Initiates background processing by running the WP-Cron event scheduler. This command is executed via the WordPress Command Line Interface (WP-CLI). ```bash wp cron event run --due-now ``` -------------------------------- ### Updating a Plugin via Git Updater REST API Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Shows how to use `curl` to call the Git Updater REST API to update a specific plugin. The 'plugin' parameter is used to identify the plugin by its slug, and the response indicates a successful update with detailed messages. ```bash $ curl "http://localhost/wordpress/wp-json/git-updater/v1/update/?key=76bb2b7c819c36ee37292b6978a4ad61&plugin=mickesplugin" { "messages": [ "Downloading update from https:\/\/api.github.com\/repos\/limikael\/mickesplugin\/zipball\/master<\/span>…", "Unpacking the update…", "Installing the latest version…", "Removing the old version of the plugin…", "Plugin updated successfully." ], "success": true } ``` -------------------------------- ### Ignore WordPress.org Directory Completely using gu_ignore_dot_org Filter Source: https://git-updater.com/knowledge-base/wordpress-org-directory Filter hook to completely bypass WordPress.org directory and update exclusively from git hosts like GitHub. Returns a boolean value (default false). Overridden if gu_api_domain hook is set. Provides complete control over update sources. ```PHP add_filter( 'gu_ignore_dot_org', '__return_true' ); ``` -------------------------------- ### Reset Branch REST API Endpoint Source: https://git-updater.com/knowledge-base/remote-management-restful-endpoints Allows resetting a plugin or theme's current branch via a REST API endpoint. This is useful if the branch has been deleted upstream. Requires a key and either 'plugin' or 'theme' argument with the slug. ```HTTP https://localhost/wp-json/git-updater/v1/reset-branch/?key=xxxxxxxxxxxxxx&plugin=my-plugin ``` -------------------------------- ### Run at Scale by Bypassing API Calls (PHP) Source: https://git-updater.com/knowledge-base/developer-hooks The 'gu_run_at_scale' filter hook bypasses wp_remote_get calls for repository metadata, readme.txt, and changelogs. This can significantly improve performance when Git Updater is used at scale by omitting these API requests. ```php add_filter( 'gu_run_at_scale', '__return_true' ); ```