---
title: Authors
description: MediaPress Authors provides a solution for author attribution in WordPress, including multi-author and guest author functionality.
url: https://developers.wpengine.com/docs/newsroom/mediapress/authors/
image: https://developers.wpengine.com/og/docs/newsroom/mediapress/authors.png
---

# Authors

<!-- spell-checker:ignore yoursite -->

MediaPress Authors provides a solution for author attribution in WordPress, including multi-author and guest author functionality. This feature operates on the premise that *authors* and *users* are different entities and should be kept separate.

- *Authors* are used for content attribution, which may or may not be the person adding the content within the CMS
- *Users* are accounts within the CMS with permissions and roles that reflect their level of access

MediaPress Authors are managed as a taxonomy - similar to categories and tags - and separating authors from users has several advantages:

- Multiple authors can be assigned to a single post
- Guest authors never need to have a user account
- If a user needs to be removed from the CMS, the authors set on any content they created will be unaffected
- It’s easy to configure a generic/default author to attribute content to, if you don’t want a specific user name associated with posts

If you happen to be both a user and an author, you can set a default MediaPress Author in your user account, preventing the need to select this every time you create a new post.

Because WordPress users are traditionally treated as authors, several adjustments needed to ensure this works as expected:

- User profile pages are disabled by default (you are expected to use author term pages to display posts related to a MediaPress author)
- Custom blocks are available specifically for displaying MediaPress Author information in posts/templates
- Post information is filtered so that the author term is used in place of the original author (user) where appropriate

## Bylines

A byline is used to attribute a piece of content to one or more authors. This is stored as post meta in addition to the taxonomy relationship linking MediaPress Authors to a post.

This allows a byline to remain static. For example, if an author has a specific job role ‘suffix’ associated with them, it will be saved within the byline, if that author information changes at a later date, the byline will reflect what it was at the time the post was created.

## Filters/Actions

### PHP

#### Filters

##### `mediapress_authors_taxonomy_args`

Allows adjustment of the arguments passed when registering the `mediapress_authors` taxonomy.

This may be used to:

- Disable author profile pages (set `public` to `false`)
- Adjust the `rewrite` permalinks for author profile pages (default is `yoursite.com/profile/author-slug`)
- Adjust the default author term that is applied when no author is selected for a post (by setting `default_term`)

**Parameters**

| Name | Type    | Description                                 |
| ---- | ------- | ------------------------------------------- |
| args | `array` | The arguments passed to `register_taxonomy` |

**Usage**

```php
// Adjust the author profile url to `yoursite.com/author/author-slug`
add_filter( 'mediapress_authors_taxonomy_args', 'my_plugin_author_profile_url' );
function my_plugin_profile_url( array $args ): array {
  $args['rewrite']['slug'] = 'author';


  return $args;
}


// Redefine the default author term
add_filter( 'mediapress_authors_taxonomy_args', 'my_plugin_default_author' );
function my_plugin_default_author( array $args ): array {
  $args['default_term'] = [
    'name' => __( 'Editorial Team', 'my-plugin' ),
    'slug' => 'editorial-team',
    'description' => __( 'Our hard-working editorial team', 'my-plugin' ),
  ];


  return $args;
}
```

##### `mediapress_authors_disable_core_author_page`

Disable the core author/user pages.

**Parameters**

| Name           | Type   | Description                              |
| -------------- | ------ | ---------------------------------------- |
| should_disable | `bool` | Should the core authors page be disabled |

**Usage**

```php
// Re-enable the core author page.
add_filter( 'mediapress_authors_disable_core_author_page', '__return_false' );
```

##### `mediapress_authors_excluded_user_roles`

Excluded user roles when running the CLI migration

**Parameters**

| Name           | Type            | Description                              |
| -------------- | --------------- | ---------------------------------------- |
| excluded_roles | `array<string>` | User roles to exclude from the migration |

**Usage**

```php
add_filter( 'mediapress_authors_excluded_user_roles', 'my_plugin_user_roles_excluded_from_author_migrations' );


function my_plugin_user_roles_excluded_from_author_migrations( $roles ) {
  return array_merge( $roles, [ 'Author ] );
}
```

##### `mediapress_authors_should_create_author`

Should we create an author for the newly created user.

**Parameters**

| Name          | Type                    | Description                                                                                                            |
| ------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| should_create | `bool`                  | Should we create an author                                                                                             |
| user_id       | `int`                   | user id to create author for                                                                                           |
| user_data     | `array<string, string>` | The raw array of data passed to [wp_insert_user](https://developer.wordpress.org/reference/functions/wp_insert_user/). |

**Usage**

```php
add_filter(
  'mediapress_authors_should_create_author',
  'my_plugin_should_create_author',
  10,
  3,
);


function my_plugin_should_create_author( $should_create, $user_id, $user_data ): bool {
  if ( ! $should_create ) {
    return $should_create;
  }


  return $user_id !== 123 && $user_data['role'] !== 'author';
}
```

## CLI

### `wp mediapress authors migrate users`

Migrate all WordPress users to MediaPress authors terms.

### `wp mediapress authors migrate posts`

Migrate all WordPress users posts to MediaPress Authors

#### Synopsis

Terminal window

```sh
wp mediapress authors migrate posts [--per-page=<per-page>]
```

#### Options

```
[--per-page=<per-page>]
    Number of posts per page when assigning terms to posts
```

### `wp mediapress authors migrate create`

Create a MediaPress Author

#### Synopsis

Terminal window

```sh
wp mediapress authors create --name=<name> [--prefix=<prefix>] [--suffix=<suffix>]
  [--user-id=<user-id>] [--avatar=<avatar>]
```

#### Options

```
--name=<name>
  Author Name


[--prefix=<prefix>]
  Author's prefix e.g Dr


[--suffix=<suffix>]
  Author's suffix e.g ', Digital Editor'


[--user-id=<user-id>]
  User id to assign it to.


[--avatar=<avatar>]
  Attachment id of author
```

## Was this helpful?

Thanks for the feedback!

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebSite","@id":"https://developers.wpengine.com/#website","name":"WP Engine Product Documentation","url":"https://developers.wpengine.com/","description":"Resources for developing, deploying, and scaling on WP Engine.","inLanguage":"en-US","keywords":["API documentation","product documentation","headless WordPress","managed WordPress hosting"],"publisher":{"@id":"https://wpengine.com/#organization"}}]}
```
