[wp-trac] [WordPress Trac] #48201: post_updated_messages event stop working version 5.2.3
WordPress Trac
noreply at wordpress.org
Thu Oct 3 11:35:18 UTC 2019
#48201: post_updated_messages event stop working version 5.2.3
--------------------------+-----------------------------
Reporter: majavsc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.2.3
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I really think that there is some problem with post_updated_messages event
in 5.2.3 version. Tried the same code in vanila vrsion 4.9.11 and vanila
5.2.3. In 4.9.11 messages are overwritten and they are working good in
5.2.3 nothing’s happened.
Try to add next code in wp-content/plugins/hello.php and activate Hello
Dolly plugin:
{{{#!php
<?php
function frl_change_post_updated_labels($messages) {
global $post;
$permalink = get_permalink($post->ID);
$messages['post'] = array(
0 => '',
1 => sprintf( __('Article updated. <a href="%s">View post</a>',
'frl'), esc_url($permalink)),
2 => __('Custom field updated.', 'frl'),
3 => __('Custom field deleted.', 'frl'),
4 => __('Article updated.', 'frl'),
5 => isset($_GET['revision']) ? sprintf(__('Article restored to
revision from %s', 'frl'), wp_post_revision_title((int)$_GET['revision'],
false)) : false,
6 => sprintf( __('Article published. <a href="%s">View post</a>'),
esc_url($permalink)),
7 => __('Article saved.', 'frl'),
8 => sprintf( __('Article submitted. <a target="_blank" href="%s"
rel="noopener noreferrer">Preview</a>', 'frl'),
esc_url(add_query_arg('preview','true', $permalink))),
9 => __('Article scheduled. <a target="_blank" href="%2$s"
rel="noopener noreferrer">Preview</a>', 'frl'),
10 => sprintf( __('Article draft updated. <a target="_blank" href="%s"
rel="noopener noreferrer">Preview</a>', 'frl'),
esc_url(add_query_arg('preview', 'true', $permalink)))
);
return $messages;
}
add_filter('post_updated_messages', 'frl_change_post_updated_labels');
}}}
Also tried adding new category ‘article’ instead of ‘post’ and create new
array $messages[‘article’] and assinged post to article category but it is
working the same.
So the problem exists in both cases:
– when we want to overwrite existing messages (post, page, attachment)
– when we want to add the new message type
I would be very thankful if someone helps me with solving this.
Tnx.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48201>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list