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 | |
/** | |
* How to integrate WordPress Core updates with your custom Plugin or Theme | |
* | |
* Filter the `update_plugins` transient to report your plugin as out of date. | |
* Themes have a similar transient you can filter. | |
*/ | |
add_filter( 'site_transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
add_filter( 'transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
function wprp_extend_filter_update_plugins( $update_plugins ) { |
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
language | english_name | native_name | |
---|---|---|---|
af | Afrikaans | Afrikaans | |
ar | Arabic | العربية | |
ary | Moroccan Arabic | العربية المغربية | |
as | Assamese | অসমীয়া | |
az | Azerbaijani | Azərbaycan dili | |
azb | South Azerbaijani | گؤنئی آذربایجان | |
bel | Belarusian | Беларуская мова | |
bg_BG | Bulgarian | Български | |
bn_BD | Bengali (Bangladesh) | বাংলা |
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 | |
add_action( 'init', function(){ | |
add_rewrite_rule( '^ajax/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?','index.php?ajax=true&action=$matches[1]&type=$matches[2]&offset=$matches[3]&meta=$matches[4]','top' ); | |
}); | |
add_filter( 'query_vars', function( $query_vars ){ | |
$query_vars[] = 'ajax'; |
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 | |
add_filter( 'rest_authentication_errors', function( $result ) { | |
if ( ! empty( $result ) ) { | |
return $result; | |
} | |
if ( ! is_user_logged_in() ) { | |
return new WP_Error( 'restx_logged_out', 'Sorry, you must be logged in to make a request.', array( 'status' => 401 ) ); | |
} | |
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
(function(){ | |
/** | |
* Create a new MediaLibraryTaxonomyFilter we later will instantiate | |
*/ | |
var MediaLibraryTaxonomyFilter = wp.media.view.AttachmentFilters.extend({ | |
id: 'media-attachment-taxonomy-filter', | |
createFilters: function() { | |
var filters = {}; | |
// Formats the 'terms' we've included via wp_localize_script() |
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
set -ex | |
# Expects git clone git@github.com: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 |
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 | |
/** | |
* Fix network admin URL to include the "/wp/" base | |
* | |
* @see https://core.trac.wordpress.org/ticket/23221 | |
*/ | |
add_filter( 'network_site_url', function( $url, $path, $scheme ){ | |
$urls_to_fix = array( | |
'/wp-admin/network/', |
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 | |
/** | |
* Add a 'Add rel="nofollow" to link' checkbox to the WordPress link editor | |
* | |
* @see https://danielbachhuber.com/tip/rel-nofollow-link-modal/ | |
*/ | |
add_action( 'after_wp_tiny_mce', function(){ | |
?> | |
<script> |
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 | |
/** | |
* Allow editors and above to upload whatever they want | |
*/ | |
add_filter( 'map_meta_cap', function( $caps, $cap, $user_id ) { | |
if ( 'unfiltered_upload' !== $cap ) { | |
return $caps; | |
} |
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 | |
add_filter( 'register_post_type_args', function( $args, $post_type ) { | |
global $wp_rewrite; | |
if ( 'post' === $post_type && ! is_null( $wp_rewrite ) ) { | |
$archive_slug = 'blog'; | |
// Setting 'has_archive' ensures get_post_type_archive_template() returns an archive.php template. | |
$args['has_archive'] = $archive_slug; | |
// We have to register rewrite rules, because WordPress won't do it for us unless $args['rewrite'] is true. | |
$archive_slug = $wp_rewrite->root . $archive_slug; |
NewerOlder