Home / Admin / Remove Specific Post Type From Public Post Type List
Duplicate Snippet

Embed Snippet on Your Site

Remove Specific Post Type From Public Post Type List

This filter can be used to remove the movie post type from the public post type list.

<10
Code Preview
php
<?php
add_filter( 'aioseo_public_post_types', 'aioseo_filter_public_post_types' );
function aioseo_filter_public_post_types( $postTypes ) {
  $filteredPostTypes = [];
  foreach ( $postTypes as $postTypeObject ) {
    if ( is_array( $postTypeObject ) && 'movie' === $postTypeObject['name'] ) {
      continue;
    }
    $filteredPostTypes[] = $postTypeObject;
  }
  return $filteredPostTypes;
}

Comments

Add a Comment