Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Customize caps to edit Privacy Page
*/
add_action('map_meta_cap', function ($caps, $cap, $user_id, $args) {
$user_meta = get_userdata($user_id);
if ($user_meta) {
if (array_intersect(['shop_manager', 'administrator'], $user_meta->roles)) {
if ('manage_privacy_options' === $cap) {
$manage_name = is_multisite() ? 'manage_network' : 'manage_options';
@ouun
ouun / wpms-cron.sh
Last active October 19, 2020 15:10
#!/bin/bash
clear
PATH_TO_WORDPRESS="/var/www/public_html"
for URL in = $(wp site list --field=url --deleted=0 --archived=0 --path="$PATH_TO_WORDPRESS")
do
if [[ $URL == "http"* ]]; then
wp cron event run --all --due-now --url="$URL" --path="$PATH_TO_WORDPRESS"
fi
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@ouun
ouun / functions.php
Created February 8, 2018 20:37 — forked from varmais/functions.php
Fetch all latest Wordpress posts when using Polylang plugin
<?php
function get_default_language_posts($query)
{
if ($query->is_main_query() && is_home() && function_exists('pll_languages_list') && !is_admin()) {
$languages = pll_languages_list(array('hide_empty' => 1));
$terms = get_terms('post_translations');
$lang_default = pll_default_language();
$lang_current = pll_current_language();
$post_ids = array();