- Table of contents
- General information
- Terms
- General structure of a test
- WordPress-specific assertions and test functions
- enqueues
- creating posts
- creating terms
- attaching images
- ?
public function shutdown_action() { | |
$keys = $this->get_data_keys(); | |
$data = []; | |
foreach ( $keys as $key ) { | |
$this->data[ $key ] = isset( $this->data[ $key ] ) ? $this->data[ $key ] : []; | |
$data[ $key ] = array_replace( $this->data[ $key ], $this->{$key} ); | |
} | |
wp_cache_set( $this->get_cache_key(), $this->maybe_reduce_cache_size( $data ) ); |
[alias] | |
# archive a branch | |
ab = !sh -c 'git checkout $1 && git pull && git tag archive/$1 && git push origin $1 && git push origin archive/$1 && git checkout master && git branch -D $1 && git push origin --delete $1' - | |
# archive a branch (to a remote other than origin) | |
abb = !sh -c 'git checkout $1 && git pull $2 $1 && git tag archive/$1 && git push $2 $1 && git push $2 archive/$1 && git checkout master && git branch -D $1 && git push $2 --delete $1' - | |
# list aliases | |
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' |
# Prevent wp-config.php and .htaccess | |
# from being accessed use this code | |
<Files wp-config.php> | |
order allow,deny | |
deny from all | |
</Files> | |
<Files .htaccess> | |
order allow,deny |
<?php | |
define( 'DOING_AJAX', true ); | |
define( 'WP_ADMIN', true ); | |
define( 'WP_IMPORTING', true ); | |
$err = array(); | |
/** Load WordPress Bootstrap */ | |
require_once 'wp-load.php'; |
<?php | |
define( 'DOING_AJAX', true ); | |
define( 'WP_ADMIN', true ); | |
define( 'WP_IMPORTING', true ); | |
$err = array(); | |
/** Load WordPress Bootstrap */ | |
require_once 'wp-load.php'; |
// Create token header as a JSON string
$header = json_encode(['typ' => 'JWT', 'alg' => 'HS256']);
// Create token payload as a JSON string
$payload = json_encode(['user_id' => 123]);
// Encode Header to Base64Url String
$base64UrlHeader = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header));
/** | |
* Optimize WooCommerce Scripts | |
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
function child_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
<?php | |
/* | |
* ================================================================================================= | |
* Below both hooks works for custom post types. | |
* e.g. Suppose we have custom post-type name : Books | |
* @ref https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column | |
* ================================================================================================= | |
*/ |