Deprecated in favor of https://danielbachhuber.com/wp-5-0-rest-api-tasks/
This file contains hidden or 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 | |
add_filter( 'comments_open', '__return_false' ); | |
add_action( 'admin_menu', function(){ | |
global $menu; | |
// Remove Comments | |
if ( isset( $menu[25] ) ) { | |
unset( $menu[25] ); | |
} |
This file contains hidden or 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 | |
/** | |
* Use the 'medium' image size for a Tasty Recipe card when it exists. | |
* | |
* @param array $template_vars Template variables to be used. | |
* @param object $recipe Recipe object. | |
*/ | |
add_filter( 'tasty_recipes_recipe_template_vars', function( $template_vars, $recipe ) { | |
$recipe_json = $recipe->to_json(); | |
if ( ! empty( $recipe_json['image_sizes']['medium'] ) ) { |
This file contains hidden or 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 | |
/** | |
* Use the post's featured image when the EasyRecipe doesn't have an image. | |
* | |
* @param integer $image_id Image ID to be used. | |
* @param object $recipe Tasty Recipe object. | |
* @param integer $post_id Original post ID. | |
*/ | |
add_filter( 'tasty_recipes_convert_easyrecipe_image_id', function( $image_id, $recipe, $post_id ) { | |
if ( $image_id ) { |
This file contains hidden or 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 | |
/** | |
* Includes alt text on a Tasty Pins hidden image if none yet exists. | |
* | |
* @param string $image_content Image content HTML string. | |
* @param integer $hidden_image Hidden image ID. | |
* @return string | |
*/ | |
add_filter( | |
'tasty_pins_hidden_image_html', |
This file contains hidden or 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
/** | |
* Converts numbers to fractions: | |
* - 1.25 to 1 1/4 | |
* - 2 to 2 | |
*/ | |
var numberToFraction = function( amount ) { | |
// This is a whole number and doesn't need modification. | |
if ( parseFloat( amount ) === parseInt( amount ) ) { | |
return amount; | |
} |
This file contains hidden or 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 | |
/** | |
* Filtering 'intermediate_image_sizes_advanced' to return an empty array | |
* prior to calling media_sideload_image() will prevent thumbnails from being created. | |
*/ | |
add_filter( 'intermediate_image_sizes_advanced', '__return_empty_array' ); | |
$attachment_id = media_sideload_image( $image_url, $post_id, '', 'id' ); | |
remove_filter( 'intermediate_image_sizes_advanced', '__return_empty_array' ); |
This file contains hidden or 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 | |
/** | |
* Filters wp_remote_get() to: | |
* 1. Return a value from the cache when it's available. | |
* 2. Write a value to the cache when it's been fetched. | |
* | |
* Requires the WP_IMPORT_CACHE constant to be set to a writable directory. | |
*/ | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { |
This file contains hidden or 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
set -ex | |
# Expects git clone [email protected]:WordPress/gutenberg.git ~/gutenberg | |
cd ~/gutenberg | |
# Reset working directory | |
git checkout -f master | |
git pull origin master | |
# Run the initial gutenberg ZIP build | |
yes | npm run package-plugin | |
# Modify 'Version: ' to bump to next version and append short hash (e.g. '4.0-alpha-610aa4e') | |
echo '<?php file_put_contents( "gutenberg.php", preg_replace_callback( "#Version: (.+)#", function( $matches ) { $new_version = (float) $matches[1] + .1; $new_version .= ".0-alpha-" . substr( shell_exec( "git rev-parse HEAD" ), 0, 7 ); return str_replace( $matches[1], $new_version, $matches[0] ); }, file_get_contents( "gutenberg.php" ) ) );' | php |
From https://github.com/WordPress/gutenberg/milestone/39
Avoid direct use of user capabilities in client-side code
- WordPress/gutenberg#6361
- Status: Blocked — API doesn't communicate user capabilities as descriptively as it needs to.
Support for automatically iterating paginated resources in core-data
- WordPress/gutenberg#6180
- Status: Uncertain — Lots of back and forth regarding UX and accessibility, but unclear what scope of work is.