Skip to content

Instantly share code, notes, and snippets.

View peterwilsoncc's full-sized avatar

Peter Wilson peterwilsoncc

View GitHub Profile
<?php
namespace PWCC;
/**
* Register meta box(es).
*/
function wpdocs_register_meta_boxes() {
add_meta_box( 'meta-box-id', __( 'My Meta Box', 'textdomain' ), __NAMESPACE__ . '\\wpdocs_my_display_callback', 'post' );
}
name: Version checks
on:
push:
branches:
- master
pull_request:
jobs:
# Compares the header information in the readme.txt and the main plugin file
<?php
namespace PWCC\NoIndexPPP;
if ( ! is_admin() ) {
add_action( 'pre_get_posts', __NAMESPACE__ . '\\show_public_preview' );
}
/**
* Filter the Yoast SEO and AIOSEO robots meta tag for public previews.
*
javascript:( (d) => { d.querySelector( '.q9EjXc' ).style.visibility="hidden";d.querySelector('.yvv8Re.OAburf').style.backgroundColor='black';d.querySelector('.l4V7wb.Fxmcue').style.display="none"; } )(window.document);
<?php
namespace PWCC\WP_Cron_Cavalcade;
/**
* Initialize the plugin.
*/
function bootstrap() {
/*
* The Cavalcade plugin uses a different rescheduling algorithm to WordPress
* Core. This overrides the Cavalcade changes to use the WordPress default.
<?php
namespace PWCC\AsyncDelete;
const ACTION_HOOK = 'pwcc.async_delete_post';
/**
* Register hooks for WordPress.
*/
function bootstrap() {
add_filter( 'pre_delete_post', __NAMESPACE__ . '\\async_delete_post', 10, 3 );
<?php
namespace PWCC\NightlyCronSchedule;
use DateTime;
use DateTimeZone;
use HM\Cavalcade\Plugin\Job;
/**
* Register hooks for WordPress.
*/
array(6) {
["width"]=>
int(2560)
["height"]=>
int(1440)
["file"]=>
string(32) "2019/12/tachyon-large-scaled.jpg"
["sizes"]=>
array(13) {
["medium"]=>
{
"require": {
"altis/cloud": "^2.0",
"altis/cms-installer": "0.3.2",
"altis/core": "^2.0",
"altis/media": "^2.0",
"johnpbloch/wordpress": "5.3.*",
},
"require-dev": {
"altis/dev-tools": "^2.0",
@peterwilsoncc
peterwilsoncc / remove-caps.php
Created September 30, 2019 21:59
Remove all caps unrelated to posts for all WordPress accounts.
<?php
/* ********************************************************* *
* WARNING WARNING WARNING! *
* Written in about ten minutes, only roughly tested. *
* ********************************************************* */
/**
* Do not allow meta caps unrelated to posts.
*
* @param string[] $caps Array of required capabilities.