rn array_values( json_decode( wp_json_encode( $objects ), true ) ); } /** * Returns the names of the included post types or taxonomies. * * @since 4.1.3 * * @param array|string $objects The included post types/taxonomies. * @param boolean $arePostTypes Whether the objects are post types. * @return array The names of the included post types/taxonomies. */ private function getIncludedObjects( $objects, $arePostTypes = true ) { if ( is_array( $objects ) ) { return $objects; } if ( empty( $objects ) ) { return []; } $exploded = explode( ',', $objects ); $objects = array_map( function( $object ) { return trim( $object ); }, $exploded ); $publicObjects = $arePostTypes ? aioseo()->helpers->getPublicPostTypes( true ) : aioseo()->helpers->getPublicTaxonomies( true ); $objects = array_filter( $objects, function( $object ) use ( $publicObjects ) { return in_array( $object, $publicObjects, true ); }); return $objects; } }