[wp-trac] [WordPress Trac] #45250: Backward compatibility: Impossible to prefill a new post in WP 5.0
WordPress Trac
noreply at wordpress.org
Thu Nov 1 10:16:12 UTC 2018
#45250: Backward compatibility: Impossible to prefill a new post in WP 5.0
--------------------------+-----------------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.0
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
An important feature that Polylang provides to the users is to prefill the
new translations with information coming from the original post. Every
type of content can be prefilled: post fields, taxonomies and post metas.
In WordPress 5.0-beta2-43852, the editor does not read informations filled
int the global `$post` ( for post fields) or in the database ( for
taxonomies and metas) for a new post.
This issue had been reported during the development of Gutenberg in
https://github.com/WordPress/gutenberg/issues/7000 and was partially fixed
by https://github.com/WordPress/gutenberg/pull/10660 and
https://github.com/WordPress/gutenberg/pull/10362
but in WordPress 5.0, nothing works anymore.
Here is a small plugin demonstrating the issue (you may need to change the
thumbnail id for the test).
{{{
<?php
/*
Plugin name: Test Post Prefill
*/
add_action( 'add_meta_boxes', function( $post_type, $post ) {
if ( 'post-new.php' == $GLOBALS['pagenow'] ) {
$post->post_title = 'Test post prefill';
$post->post_content = 'Test post content prefill';
$post->menu_order = 10;
$post->comment_status = 'open';
$post->ping_status = 'closed';
wp_set_post_categories( $post->ID, 1 );
wp_set_post_tags( $post->ID, 'tag' );
set_post_thumbnail( $post->ID, 42 );
stick_post( $post->ID );
}
}, 10, 2 );
}}}
I'll also attach a picture with the test results.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45250>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list