# wordpress-seo/27.9/src/ai/generator/user-interface/route-permission-trait.php

Yoast SEO – Advanced SEO with real-time guidance and built-in AI, version 27.9. 28 lines.

- Page: https://pluginprobe.com/plugins/wordpress-seo/27.9/code/src/ai/generator/user-interface/route-permission-trait.php
- Raw: https://pluginprobe.com/plugins/wordpress-seo/27.9/raw/src/ai/generator/user-interface/route-permission-trait.php
- Modified: 2026-03-17T12:01:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wordpress-seo/27.9/code/src/ai/generator/user-interface/route-permission-trait.php#L10-L20`.

```php
<?php

// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.

namespace Yoast\WP\SEO\AI\Generator\User_Interface;

/**
 * Trait for common permission checks in route classes.
 */
trait Route_Permission_Trait {

	/**
	 * Checks:
	 * - if the user is logged
	 * - if the user can edit posts
	 *
	 * @return bool Whether the user is logged in, can edit posts and the feature is active.
	 */
	public function check_permissions(): bool {
		$user = \wp_get_current_user();
		if ( $user === null || $user->ID < 1 ) {
			return false;
		}

		return \user_can( $user, 'edit_posts' );
	}
}

```
