<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[44260] trunk: Editor: Add custom fields meta box support in the block editor.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/44260">44260</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/44260","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>desrosj</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-12-17 03:51:08 +0000 (Mon, 17 Dec 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Add custom fields meta box support in the block editor.
This brings support for the custom fields meta box into the new block editor.
The `webpack` and `copy-webpack-plugin` packages have also been updated.
This does not bump the `@wordpress` packages like in <a href="https://core.trac.wordpress.org/changeset/43861">[43861]</a> because of conflicts with package versions already installed in `trunk`. The packages will be brought up to date in a subsequent merge.
Merges <a href="https://core.trac.wordpress.org/changeset/43861">[43861]</a> and <a href="https://core.trac.wordpress.org/changeset/43863">[43863]</a> into trunk.
See <a href="https://core.trac.wordpress.org/ticket/45145">#45145</a>.
Fixes <a href="https://core.trac.wordpress.org/ticket/45257">#45257</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkpackagelockjson">trunk/package-lock.json</a></li>
<li><a href="#trunkpackagejson">trunk/package.json</a></li>
<li><a href="#trunksrcwpadmineditformblocksphp">trunk/src/wp-admin/edit-form-blocks.php</a></li>
<li><a href="#trunksrcwpadminincludesmetaboxesphp">trunk/src/wp-admin/includes/meta-boxes.php</a></li>
<li><a href="#trunksrcwpadminincludespostphp">trunk/src/wp-admin/includes/post.php</a></li>
<li><a href="#trunksrcwpadminpostphp">trunk/src/wp-admin/post.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk 2018-12-17 03:38:25 UTC (rev 44259)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk 2018-12-17 03:51:08 UTC (rev 44260)
</ins><a id="trunk"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43860,43862,43867-43883,43885-43887,43889,43892-43894,43897-43902,43904-43905,43908-43909,43912,43915,43926-43929,43954,43956,43961-43963,44014,44017
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43883,43885-43887,43889,43892-43894,43897-43902,43904-43905,43908-43909,43912,43915,43926-43929,43954,43956,43961-43963,44014,44017
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunkpackagelockjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/package-lock.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/package-lock.json 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/package-lock.json 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3562,9 +3562,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "dev": true
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "copy-webpack-plugin": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "version": "4.5.2",
- "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.5.2.tgz",
- "integrity": "sha512-zmC33E8FFSq3AbflTvqvPvBo621H36Afsxlui91d+QyZxPIuXghfnTsa1CuqiAaCPgJoSUWfTFbKJnadZpKEbQ==",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.6.0.tgz",
+ "integrity": "sha512-Y+SQCF+0NoWQryez2zXn5J5knmr9z/9qSQt7fbL78u83rxmigOy8X5+BFn8CFSuX+nKT8gpYwJX68ekqtQt6ZA==",
</ins><span class="cx" style="display: block; padding: 0 10px"> "dev": true,
</span><span class="cx" style="display: block; padding: 0 10px"> "requires": {
</span><span class="cx" style="display: block; padding: 0 10px"> "cacache": "^10.0.4",
</span></span></pre></div>
<a id="trunkpackagejson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/package.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/package.json 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/package.json 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,7 +17,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "@wordpress/library-export-default-webpack-plugin": "1.0.4",
</span><span class="cx" style="display: block; padding: 0 10px"> "autoprefixer": "^9.1.5",
</span><span class="cx" style="display: block; padding: 0 10px"> "check-node-version": "3.2.0",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "copy-webpack-plugin": "^4.5.2",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "copy-webpack-plugin": "^4.6.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "cssnano": "^4.1.4",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt": "~1.0.3",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-banner": "^0.6.0",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +49,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "source-map-loader": "^0.2.4",
</span><span class="cx" style="display: block; padding: 0 10px"> "uglify-js": "^3.4.9",
</span><span class="cx" style="display: block; padding: 0 10px"> "uglifyjs-webpack-plugin": "^2.0.1",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "webpack": "^4.20.2",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "webpack": "^4.24.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "webpack-dev-server": "^3.1.9",
</span><span class="cx" style="display: block; padding: 0 10px"> "webpack-livereload-plugin": "^2.1.1"
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span></span></pre></div>
<a id="trunksrcwpadmineditformblocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/edit-form-blocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/edit-form-blocks.php 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/src/wp-admin/edit-form-blocks.php 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,6 +202,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Image sizes.
+$image_sizes = get_intermediate_image_sizes();
+$image_sizes[] = 'full';
+
+/** This filter is documented in wp-admin/includes/media.php */
+$image_size_names = apply_filters(
+ 'image_size_names_choose',
+ array(
+ 'thumbnail' => __( 'Thumbnail' ),
+ 'medium' => __( 'Medium' ),
+ 'large' => __( 'Large' ),
+ 'full' => __( 'Full Size' ),
+ )
+);
+
+$available_image_sizes = array();
+foreach ( $image_sizes as $image_size_slug ) {
+ $available_image_sizes[] = array(
+ 'slug' => $image_size_slug,
+ 'name' => isset( $image_size_names[ $image_size_slug ] ) ? $image_size_names[ $image_size_slug ] : $image_size_slug,
+ );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Lock settings.
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = wp_check_post_lock( $post->ID );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $user_id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -257,6 +280,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'maxUploadFileSize' => $max_upload_size,
</span><span class="cx" style="display: block; padding: 0 10px"> 'allowedMimeTypes' => get_allowed_mime_types(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'styles' => $styles,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'availableImageSizes' => $available_image_sizes,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'postLock' => $lock_details,
</span><span class="cx" style="display: block; padding: 0 10px"> 'postLockUtils' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'nonce' => wp_create_nonce( 'lock-post_' . $post->ID ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,6 +287,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'unlockNonce' => wp_create_nonce( 'update-post_' . $post->ID ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Whether or not to load the 'postcustom' meta box is stored as a user meta
+ // field so that we're not always loading its assets.
+ 'enableCustomFields' => (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $autosave = wp_get_post_autosave( $post_ID );
</span></span></pre></div>
<a id="trunksrcwpadminincludesmetaboxesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/meta-boxes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/meta-boxes.php 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/src/wp-admin/includes/meta-boxes.php 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1463,11 +1463,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( post_type_supports( $post_type, 'custom-fields' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $args = array(
- '__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
- '__block_editor_compatible_meta_box' => true,
- );
- add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $screen = get_current_screen();
+ if ( ! $screen || ! $screen->is_block_editor() || (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ) ) {
+ add_meta_box(
+ 'postcustom',
+ __( 'Custom Fields' ),
+ 'post_custom_meta_box',
+ null,
+ 'normal',
+ 'core',
+ array(
+ '__back_compat_meta_box' => false,
+ '__block_editor_compatible_meta_box' => true,
+ )
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpadminincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/post.php 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/src/wp-admin/includes/post.php 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2112,7 +2112,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'slug' => 'common',
</span><span class="cx" style="display: block; padding: 0 10px"> 'title' => __( 'Common Blocks' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'icon' => 'screenoptions',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'icon' => null,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'slug' => 'formatting',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2214,6 +2214,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <form class="metabox-base-form">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php the_block_editor_meta_box_post_form_hidden_fields( $post ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <form id="toggle-custom-fields-form" method="post" action="<?php echo esc_attr( admin_url( 'post.php' ) ); ?>">
+ <?php wp_nonce_field( 'toggle-custom-fields' ); ?>
+ <input type="hidden" name="action" value="toggle-custom-fields" />
+ </form>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php foreach ( $locations as $location ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <form class="metabox-location-<?php echo esc_attr( $location ); ?>" onsubmit="return false;">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="poststuff" class="sidebar-open">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2289,6 +2293,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> printf( "<script type='text/javascript'>\n%s\n</script>\n", trim( $script ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * If the 'postcustom' meta box is enabled, then we need to perform some
+ * extra initialization on it.
+ */
+ $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true );
+ if ( $enable_custom_fields ) {
+ $script = "( function( $ ) {
+ if ( $('#postcustom').length ) {
+ $( '#the-list' ).wpList( {
+ addBefore: function( s ) {
+ s.data += '&post_id=$post->ID';
+ return s;
+ },
+ addAfter: function() {
+ $('table#list-table').show();
+ }
+ });
+ }
+ } )( jQuery );";
+ wp_enqueue_script( 'wp-lists' );
+ wp_add_inline_script( 'wp-lists', $script );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Reset meta box data.
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_meta_boxes = $_original_meta_boxes;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminpostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/post.php 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/src/wp-admin/post.php 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -312,6 +312,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_redirect( $url );
</span><span class="cx" style="display: block; padding: 0 10px"> exit();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'toggle-custom-fields':
+ check_admin_referer( 'toggle-custom-fields' );
+
+ $current_user_id = get_current_user_id();
+ if ( $current_user_id ) {
+ $enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
+ update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
+ }
+
+ wp_safe_redirect( wp_get_referer() );
+ exit();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires for a given custom post action request.
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php 2018-12-17 03:38:25 UTC (rev 44259)
+++ trunk/src/wp-includes/script-loader.php 2018-12-17 03:51:08 UTC (rev 44260)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -235,6 +235,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'data' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'lodash',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-compose',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wp-deprecated',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wp-element',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-is-shallow-equal',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -351,6 +352,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'lodash',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-blocks',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-data',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'wp-deprecated',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wp-escape-html',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp-polyfill',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span></span></pre>
</div>
</div>
</body>
</html>