[wp-trac] [WordPress Trac] #44530: Post or page custom fields give wrong error message when enter value only.
WordPress Trac
noreply at wordpress.org
Sun Sep 28 11:26:28 UTC 2025
#44530: Post or page custom fields give wrong error message when enter value only.
---------------------------------------+-------------------------
Reporter: harsh175 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Editor | Version:
Severity: normal | Resolution: worksforme
Keywords: has-screenshots has-patch | Focuses:
---------------------------------------+-------------------------
Changes (by SirLouen):
* status: new => closed
* resolution: => worksforme
* focuses: administration =>
* component: Posts, Post Types => Editor
* milestone: Future Release =>
Comment:
== Reproduction Report
=== Description
❌ This report can't validate that the issue can be reproduced.
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.1
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: Windows 10/11
- Theme: Twenty Sixteen 3.6
- MU Plugins: None activated
- Plugins:
* BBB Testing Dolly
* Classic Editor 1.6.7
* Test Reports 1.2.0
=== Testing Instrutions
1. Using the code provided below.
2. ❓ If no key is provided, nothing is stored.
=== Actual Results
1. ❌ Error condition occurs (reproduced).
=== Additional Notes
- I'm not sure if the resolution #43559 has impacted this, but I cannot
reproduce this anymore.
- I've provided a simple example for adding new post meta, for key and
value. Please don't hesitate to expand this if I'm missing something.
=== Supplemental Artifacts
Sample code:
{{{#!php
<?php
function custom_kv_meta_box() {
add_meta_box(
'custom_kv_meta',
__('Custom Key-Value', 'textdomain'),
'custom_kv_meta_callback',
'post',
'side',
'default'
);
}
add_action('add_meta_boxes', 'custom_kv_meta_box');
function custom_kv_meta_callback($post) {
wp_nonce_field('custom_kv_meta_nonce', 'custom_kv_meta_nonce');
echo '<label for="custom_kv_key">' . __('Key:', 'textdomain') .
'</label><br>';
echo '<input type="text" id="custom_kv_key" name="custom_kv_key"
value="" style="width:100%;"><br><br>';
echo '<label for="custom_kv_value">' . __('Value:', 'textdomain') .
'</label><br>';
echo '<input type="text" id="custom_kv_value" name="custom_kv_value"
value="" style="width:100%;">';
}
function custom_kv_save_meta($post_id) {
if (!isset($_POST['custom_kv_meta_nonce']) ||
!wp_verify_nonce($_POST['custom_kv_meta_nonce'], 'custom_kv_meta_nonce'))
{
return;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!current_user_can('edit_post', $post_id)) {
return;
}
add_post_meta($post_id, $_POST['custom_kv_key'],
$_POST['custom_kv_value']);
}
add_action('save_post', 'custom_kv_save_meta');
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44530#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list