Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wordpres.../src/helpers
File: primary-term-helper.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Helpers;
[2] Fix | Delete
[3] Fix | Delete
use stdClass;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* A helper object for primary terms.
[7] Fix | Delete
*/
[8] Fix | Delete
class Primary_Term_Helper {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Generate the primary term taxonomies.
[12] Fix | Delete
*
[13] Fix | Delete
* @param int $post_id ID of the post.
[14] Fix | Delete
*
[15] Fix | Delete
* @return array The taxonomies.
[16] Fix | Delete
*/
[17] Fix | Delete
public function get_primary_term_taxonomies( $post_id ) {
[18] Fix | Delete
$post_type = \get_post_type( $post_id );
[19] Fix | Delete
$all_taxonomies = \get_object_taxonomies( $post_type, 'objects' );
[20] Fix | Delete
$all_taxonomies = \array_filter( $all_taxonomies, [ $this, 'filter_hierarchical_taxonomies' ] );
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Filters which taxonomies for which the user can choose the primary term.
[24] Fix | Delete
*
[25] Fix | Delete
* @param array $taxonomies An array of taxonomy objects that are primary_term enabled.
[26] Fix | Delete
* @param string $post_type The post type for which to filter the taxonomies.
[27] Fix | Delete
* @param array $all_taxonomies All taxonomies for this post types, even ones that don't have primary term
[28] Fix | Delete
* enabled.
[29] Fix | Delete
*/
[30] Fix | Delete
$taxonomies = (array) \apply_filters( 'wpseo_primary_term_taxonomies', $all_taxonomies, $post_type, $all_taxonomies );
[31] Fix | Delete
[32] Fix | Delete
return $taxonomies;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Returns whether or not a taxonomy is hierarchical.
[37] Fix | Delete
*
[38] Fix | Delete
* @param stdClass $taxonomy Taxonomy object.
[39] Fix | Delete
*
[40] Fix | Delete
* @return bool True for hierarchical taxonomy.
[41] Fix | Delete
*/
[42] Fix | Delete
protected function filter_hierarchical_taxonomies( $taxonomy ) {
[43] Fix | Delete
return (bool) $taxonomy->hierarchical;
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function