alleyinteractive / alleyinteractive/wordpress-fieldmanager
If using Fieldmanager_Datasource_Post::$save_to_post_parent, parent cannot be unset
- Vorherrschende Sprache
- PHP
- Sterne
- 563
- Forks
- 99
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Using the following code,
```php
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](https://github.com/alleyinteractive/wordpress-fieldmanager/blob/a5a7bde9723240f477f05bdfcc7036659e887c03/php/datasource/class-fieldmanager-datasource-post.php#L210-L212) is easily identified, though we'll have to think through the impact of removing that.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.