This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PasswordChangeEmailHandler { | |
/** | |
* User ID of the registered user. | |
* | |
* @var int | |
*/ | |
private $registered_user_id = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_super_admin($result, $source, $args, $context, $info, $type_name, $field_key, $field, $field_resolver) { | |
if ( $type_name === 'RootQuery' && $field_key === 'users') { | |
$result['edges'] = array_filter($result['edges'], function($edge) { | |
return !is_super_admin((int)$edge["node"]); | |
}); | |
} | |
return $result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete all transients from the database whose keys have a specific prefix. | |
* | |
* @param string $prefix The prefix. Example: 'my_cool_transient_'. | |
*/ | |
function delete_transients_with_prefix( $prefix ) { | |
foreach ( get_transient_keys_with_prefix( $prefix ) as $key ) { | |
delete_transient( $key ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function delete_all_post_count_transients() { | |
$post_types = get_post_types(); | |
$years = get_all_possible_years(); | |
$months = get_all_possible_months(); | |
foreach ( $post_types as $post_type ) { | |
foreach ( $years as $year ) { | |
foreach ( $months as $month ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function set_post_count_transient( $count, $post_type, $year, $month ) { | |
$transient_key = "km_post_count_{$post_type}_{$year}_{$month}"; | |
set_transient( $transient_key, $count, WEEK_IN_SECONDS ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Harness\Gutenberg; | |
use WPGraphQLGutenberg\WPGraphQLGutenberg; | |
use WPGraphQL\Registry\TypeRegistry; | |
use Harness\Interfaces\Hookable; | |
class ShortcodeBlockModifier implements Hookable { | |
public function register_hooks() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the value of the first array element that satisfies the callback function. | |
* Similar to JavaScript's Array.prototype.find() method. | |
* | |
* @param array $array The array. | |
* @param callable $callback The callback function. | |
* | |
* @return mixed The value of the element, or null if not found. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CoreArchivesBlock implements Block { | |
attributes: CoreArchivesBlockAttributes | |
name: String! | |
innerBlocks: [Block]! | |
isValid: Boolean! | |
originalContent: String! | |
parentId: Int | |
parent: PostObjectTypesUnion | |
renderedContent: String! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cars = [ | |
{make: "ford", model: "mustang"}, | |
{make: "toyota", model: "camry"}, | |
{make: "ford", model: "fiesta"}, | |
{make: "chevrolet", model: "volt"}, | |
{make: "ford", model: "escape"}, | |
{make: "chrysler", model: "pacifica"}, | |
] | |
const fordCarIndices = cars.reduce((fordCarIndices, field, index) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Remove Slug from Custom Post Type | |
* Description: Remove slug from custom post type URLs. | |
* Version: 0.1.0 | |
* Author: Kellen Mace | |
* Author URI: https://kellenmace.com/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ |