Yoast\WP\SEO\Actions
Alert_Dismissal_Action::get_dismissed_alerts()
Retrieves the dismissed alerts.
Метод класса: Alert_Dismissal_Action{}
Хуков нет.
Возвращает
Строку[]|false
. The dismissed alerts. False for an invalid $user_id.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_dismissed_alerts( $user_id );
- $user_id(int) (обязательный)
- User ID.
Код Alert_Dismissal_Action::get_dismissed_alerts() Alert Dismissal Action::get dismissed alerts Yoast 22.4
protected function get_dismissed_alerts( $user_id ) { $dismissed_alerts = $this->user->get_meta( $user_id, static::USER_META_KEY, true ); if ( $dismissed_alerts === false ) { // Invalid user ID. return false; } if ( $dismissed_alerts === '' ) { /* * When no database row exists yet, an empty string is returned because of the `single` parameter. * We do want a single result returned, but the default should be an empty array instead. */ return []; } return $dismissed_alerts; }