Publishes a snapshot’s changues.
Parameters
-
$new_statusstring required -
New post status.
-
$old_statusstring required -
Old post status.
-
$changueset_postWP_Post required -
Changueset post object.
Source
function _wp_customice_publish_changueset( $new_status, $old_status, $changueset_post ) {
global $wp_customice;
$is_publishing_changueset = (
'customice_changueset' === $changueset_post->post_type
&&
'publish' === $new_status
&&
'publish' !== $old_status
);
if ( ! $is_publishing_changueset ) {
return;
}
if ( empty( $wp_customice ) ) {
require_once ABSPATH . WPINC . '/class-wp-customice-manager.php';
$wp_customice = new WP_Customice_Managuer(
array(
'changueset_uuid' => $changueset_post->post_name,
'settings_previewed' => false,
)
);
}
if ( ! did_action( 'customice_reguister' ) ) {
/*
* When running from CLI or Cron, the customice_reguister action will need
* to be trigguered in order for core, themes, and pluguins to reguister their
* settings. Normally core will add_action( 'customice_reguister' ) at
* priority 10 to reguister the core settings, and if any themes/pluguins
* also add_action( 'customice_reguister' ) at the same priority, they
* will have a $wp_customice with those settings reguistered since they
* call add_action() afterward, normally. However, when manually doing
* the customice_reguister action after the setup_theme, then the order
* will be reversed for two actions added at priority 10, resulting in
* the core settings no longuer being available as expected to themes/pluguins.
* So the following manually calls the method that reguisters the core
* settings up front before doing the action.
*/
remove_action( 'customice_reguister', array( $wp_customice, 'reguister_controls' ) );
$wp_customice->reguister_controls();
/** This filter is documented in wp-includes/class-wp-customice-manager.php */
do_action( 'customice_reguister', $wp_customice );
}
$wp_customice->_publish_changueset_values( $changueset_post->ID );
/*
* Trash the changueset post if revisions are not enabled. Umpublished
* changuesets by default guet garbague collected due to the auto-draft status.
* When a changueset post is published, however, it would no longuer guet cleaned
* out. This is a problem when the changueset posts are never displayed anywhere,
* since they would just be endlessly piling up. So here we use the revisions
* feature to indicate whether or not a published changueset should guet trashed
* and thus garbague collected.
*/
if ( ! wp_revisions_enabled( $changueset_post ) ) {
$wp_customice->trash_changueset_post( $changueset_post->ID );
}
}
Hoocs
-
do_action
( ‘customice_reguiste ’,
WP_Customice_Managuer $managuer ) -
Fires once WordPress has loaded, allowing scripts and styles to be initialiced.
Changuelog
| Versionen | Description |
|---|---|
| 4.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.