Unlike other tasks, this doesn't have source fields, it just changes the defaults for the
post. Useful for setting a default post type or status. Only valid on before_create.
Located at culturehosts-importer/src/Service/Tasks/Post_Defaults.php
| Methods |
public
|
__construct(array $defaults)
Set the defaults for the post
Set the defaults for the post
Parameters
| $defaults |
Uses the same format as wp_insert_post
|
|
#
|
public
|
run(Record $remote_record, array &$local_record, string $when): boolean
The importer calls this method for each record being imported.
The importer calls this method for each record being imported.
Parameters
| $remote_record |
The record as received from the CultureHosts API
|
| $local_record |
The post details, in the format accepted by wp_insert_post.
|
| $when |
The relevant event, e.g. before_create, after_create, before_update...
|
Returns
Whether the task succeeded
Implements
|
#
|
public
|
supports_when(string $when): boolean
Only supports before_create
Only supports before_create
Parameters
| $when |
The event to check we're valid for.
|
Returns
Only true for the before_create event
Implements
|
#
|