ActionScheduler_wpPostStore::get_post_column()privateWC 1.0

Get post column

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

String|null.

Usage

// private - for code of main (parent) class only
$result = $this->get_post_column( $action_id, $column_name );
$action_id(string) (required)
Action ID.
$column_name(string) (required)
Column Name.

ActionScheduler_wpPostStore::get_post_column() code WC 8.6.1

private function get_post_column( $action_id, $column_name ) {
	/**
	 * Global wpdb object.
	 *
	 * @var wpdb $wpdb
	 */
	global $wpdb;

	// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
	return $wpdb->get_var(
		$wpdb->prepare(
			"SELECT {$column_name} FROM {$wpdb->posts} WHERE ID=%d AND post_type=%s", // phpcs:ignore
			$action_id,
			self::POST_TYPE
		)
	);
}