Skip to content

If using Fieldmanager_Datasource_Post::$save_to_post_parent, parent cannot be unset #632

@mboynes

Description

@mboynes

Using the following code,

add_action( 'init', function() {
	register_post_type( 'demo-parent-bug', [
		'label' => 'Demo Parent Bug',
		'public' => true,
		'hierarchical' => true,
	] );
} );
add_action( 'fm_post_demo-parent-bug', function() {
	$fm = new Fieldmanager_Autocomplete( array(
		'name' => 'my-parent',
		'datasource' => new Fieldmanager_Datasource_Post( array(
			'only_save_to_post_parent' => true,
			'query_args' => array(
				'post_type' => 'demo-parent-bug',
			),
		) ),
	) );
	$fm->add_meta_box( 'Parent Page', array( 'demo-parent-bug' ), 'side', 'high' );
} );

I can set the post_parent for the post type as expected. However, I cannot unset the parent. The source of this problem is easily identified, though we'll have to think through the impact of removing that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions