This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not include the PHP opening tag if PHP is already open. | |
// For request: https://wordpress.org/support/topic/way-to-automatically-create-custom-meta-titles/ | |
add_filter( | |
'the_seo_framework_generated_archive_title_items', | |
/** | |
* @param String[title,prefix,title_without_prefix] $items The generated archive title items. | |
* @param \WP_Term|\WP_User|\WP_Post_Type|null $object The archive object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't include the PHP opening tag if PHP is already open. | |
// Previous: https://gist.github.com/sybrew/0562fdbc98d7fdc134c2c9ff5bad863b. | |
// For: https://wordpress.org/support/topic/meta-og-description-for-a-custom-taxonomy-term/ | |
add_filter( 'the_seo_framework_generated_description', 'my_tsf_generated_description', 10, 2 ); | |
/** | |
* @param string $desc The generated description. | |
* @param array|null $args The query arguments. Contains 'id', 'tax', 'pta', and 'uid'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not include the PHP opening tag if PHP is already open. | |
add_filter( | |
'the_seo_framework_meta_render_data', | |
function ( $tags_render_data ) { | |
unset( $tags_render_data['canonical'] ); | |
return $tags_render_data; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't include the PHP opening tag if PHP is already open. | |
function get_primary_term_name( $post_id ) { | |
$taxonomies = array_keys( array_filter( | |
tsf()->taxonomy()->get_hierarchical( 'objects', get_post_type( $post_id ) ), | |
'is_taxonomy_viewable', | |
) ); | |
$taxonomy = reset( $taxonomies ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not include the PHP opening tag if PHP is already open. | |
// For: https://wordpress.org/support/topic/no-index-custom-post-type-specific-taxonomy/ | |
// TSF 5.0+ | |
add_filter( | |
'the_seo_framework_robots_meta_array', | |
function ( $meta, $args ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'the_seo_framework_title_from_generation', | |
function ( $title, $args ) { | |
// If Pods is deactivated, skip further processing. | |
if ( ! function_exists( 'pods_field' ) ) return $title; | |
if ( null === $args ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Do not include this PHP opening tag if PHP is already opened... | |
// Ref: https://theseoframework.com/docs/using-filters/ | |
// Ref: https://wordpress.org/support/topic/featured-image-as-ogimage/ | |
add_filter( 'the_seo_framework_image_generation_params', 'my_tsf_custom_image_generation_args', 10, 2 ); | |
/** | |
* Adjusts image generation parameters. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't include the PHP opening tag if PHP is already open. | |
add_filter( 'the_seo_framework_generated_description', 'my_tsf_generated_description', 10, 2 ); | |
/** | |
* @param string $desc The generated description. | |
* @param array|null $args The query arguments. Contains 'id', 'tax', 'pta', and 'uid'. | |
* Is null when the query is auto-determined. | |
* @return string The overwritten description. |
NewerOlder