Git is a distributed version control system that allows developers to:
- Track changes in code.
- Collaborate on projects.
- Manage multiple versions of a project.
- Work offline with a full local repository.
| <?php | |
| /* | |
| * Replacing domain for rest api requests from Gutenberg editor if youre using | |
| * WP headless and WP_SITEURL & WP_HOME are not the same domain | |
| * (has nothing to do with yoast) | |
| */ | |
| add_filter('rest_url', function($url) { | |
| $url = str_replace(home_url(), site_url(), $url); | |
| return $url; |
| function get_cached_external_json($url) { | |
| $transient_key = 'our_fetched_json_' . md5($url); | |
| $option_key = 'our_fetched_json_backup_' . md5($url); | |
| $cached_data = get_transient($transient_key); | |
| if (false !== $cached_data) { | |
| return $cached_data; | |
| } |
| function get_cached_external_json($url) { | |
| $transient_key = 'our_fetched_json_' . md5($url); | |
| $option_key = 'our_fetched_json_backup_' . md5($url); | |
| $cached_data = get_transient($transient_key); | |
| if (false !== $cached_data) { | |
| return $cached_data; | |
| } |
| # WP Config Settings | |
| wp config set AUTOMATIC_UPDATER_DISABLED true | |
| wp config set CORE_UPGRADE_SKIP_NEW_BUNDLED true | |
| # Changing Site URL to https | |
| wp option get siteurl | sed "s/http:/https:/g" | xargs -I {} wp option update siteurl {} | |
| wp option get home | sed "s/http:/https:/g" | xargs -I {} wp option update home {} | |
| # Install themes & plugins |
| module.exports = { | |
| root: true, | |
| env: { browser: true, es2020: true }, | |
| extends: [ | |
| 'eslint:recommended', | |
| 'plugin:react/recommended', | |
| 'plugin:react/jsx-runtime', | |
| 'plugin:react-hooks/recommended', | |
| ], | |
| ignorePatterns: ['dist', '.eslintrc.cjs'], |
To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:
In a terminal window on your Mac, start by updating your Homebrew.
brew doctor
Then install the Code Sniffer:
| <?php | |
| /** | |
| * @package Custom_queries | |
| * @version 1.0 | |
| */ | |
| /* | |
| Plugin Name: Custom queries | |
| Plugin URI: http://wordpress.org/extend/plugins/# | |
| Description: This is an example plugin | |
| Author: Carlo Daniele |