crontab -e
WordPress Crons running with WP-CLI each 15 minutes with :
Var/** | |
* Easily delete locotranslate backup po/mo, while originals are gitted. | |
* No need to keep them. | |
* | |
* @author Maxime CULEA | |
*/ | |
find ./ -type f -name "*.po~" -exec git clean -df {} + | |
find ./ -type f -name "*.mo~" -exec git clean -df {} + | |
find ./ -type f -name "*.pot~" -exec git clean -df {} + | |
find ./ -type f -name "*.json" -exec rm -rf {} + |
#!/usr/bin/env bash | |
# Related to WP CLI as single site, check following link | |
# @see https://gist.github.com/MaximeCulea/dbd5835a01d2b4e6a6544919db3f26a0 | |
# All wp cli comands will be declared both (as much as possible) : | |
# - with xargs (not all servers support xargs) | |
# - more native shell syntax "for in" | |
# WP Crons MS |
<?php | |
/* | |
Plugin Name: Autoptimize - Default | |
Plugin URI: https://www.maximeculea.fr | |
Description: Set options for Autoptimize | |
Author: Maxime CULEA | |
Author URI: https://maximeculea.fr | |
Version: 1.0.0 | |
*/ |
#!/bin/bash | |
# Clean a cloned git repo to avoid conflicts between multiple OS | |
# To install | |
## download the file clean-repo.sh and place it somewhere | |
## in bashrc or zhrc add an alias like so: alias cleangit="bash /path/to/clean-repo.sh" | |
## in the terminal into the project, simply lunch the alias: cleangit | |
<?php | |
/** | |
* Unregister the post type "Post" or more | |
* | |
* @see unregister_post_type() | |
* | |
* @author Maxime CULEA | |
*/ | |
add_action( 'init', function () { | |
global $wp_post_types; |
#!/bin/bash | |
# Note the fifference between Install and Update | |
# Install : if the language doesn't exist, this is the first step to get the last asked language package. It is also needed, in order to update. | |
# Update : will get the last asked translation package, only if the language is already installed. | |
# Install core in french if not existing | |
wp language core install fr_FR | |
# Update all existing core languages |
#!/usr/bin/env bash | |
# Related to WP CLI in Multisite check following link | |
# @see https://gist.github.com/MaximeCulea/575e493a061359edbb12cefc3aa4c770 | |
# Update all post's thumnbail | |
wp post update $(wp post list --format=ids --post_type=post) --post_type=post --meta_input='{"_thumbnail_id":"160"}' | |
# Generate and add dummy thumbnails to a wanted post type : https://gist.github.com/MaximeCulea/c04e62c4b6e79b4e4e17b73dd023b6c4 | |
# Search Replace with regex |
# Optimize DB : WC action scheduler | |
DELETE FROM `wp_actionscheduler_actions` WHERE `status` = 'canceled' OR `status` = 'complete' OR `status` = 'failed'; | |
# Optimize Action Scheduler queue | |
# See the WP Cli cron command: https://gist.github.com/MaximeCulea/df0766f9e17105f03717f206a22a2d39#single-site |
<?php | |
/** | |
* Delete a folder recursively | |
* | |
* @param $dir | |
* | |
* @author Maxime CULEA | |
*/ | |
private function delete_folder( $dir ) { |