WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\Notes

DataStore::save_actions() private WC 1.0

Save actions to the database. This function clears old actions, then re-inserts new if any changes are found.

{} Это метод класса: DataStore{}

Хуков нет.

Возвращает

true/false/null.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->save_actions( $note );
$note(WC_Admin_Note) (обязательный) (передается по ссылке — &)
Note object.

Код DataStore::save_actions() WC 4.7.1

<?php
private function save_actions( &$note ) {
	global $wpdb;

	$changed_props = array_keys( $note->get_changes() );

	if ( ! in_array( 'actions', $changed_props, true ) ) {
		return false;
	}

	// Process action removal. Actions are removed from
	// the note if they aren't part of the changeset.
	// See WC_Admin_Note::add_action().
	$changed_actions = $note->get_actions( 'edit' );
	$actions_to_keep = array();

	foreach ( $changed_actions as $action ) {
		if ( ! empty( $action->id ) ) {
			$actions_to_keep[] = (int) $action->id;
		}
	}

	$clear_actions_query = $wpdb->prepare(
		"DELETE FROM {$wpdb->prefix}wc_admin_note_actions WHERE note_id = %d",
		$note->get_id()
	);

	if ( $actions_to_keep ) {
		$clear_actions_query .= sprintf( ' AND action_id NOT IN (%s)', implode( ',', $actions_to_keep ) );
	}

	$wpdb->query( $clear_actions_query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

	// Update/insert the actions in this changeset.
	foreach ( $changed_actions as $action ) {
		$action_data = array(
			'note_id'       => $note->get_id(),
			'name'          => $action->name,
			'label'         => $action->label,
			'query'         => $action->query,
			'status'        => $action->status,
			'is_primary'    => $action->primary,
			'actioned_text' => $action->actioned_text,
		);

		$data_format = array(
			'%d',
			'%s',
			'%s',
			'%s',
			'%s',
			'%d',
			'%s',
		);

		if ( ! empty( $action->id ) ) {
			$action_data['action_id'] = $action->id;
			$data_format[]            = '%d';
		}

		$wpdb->replace(
			$wpdb->prefix . 'wc_admin_note_actions',
			$action_data,
			$data_format
		);
	}

	// Update actions from DB (to grab new IDs).
	$this->read_actions( $note );
}