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 | |
// Per https://wordpress.org/support/topic/term_title-in-custom-taxonomies-archive-titles/ | |
add_filter( | |
'the_seo_framework_generated_archive_title_items', | |
/** | |
* Filters the generated archive title items. | |
* |
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 opened. | |
add_filter( | |
'the_seo_framework_meta_generator_pools', | |
function ( $generator_pools ) { | |
if ( 'listings' === tsf()->query()->get_post_type_real_id() ) | |
return array_diff( $generator_pools, [ 'Schema' ] ); |
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_get_excerpt', 'my_tsf_acf_excerpt', 10, 2 ); | |
/** | |
* @param string $excerpt The obtained excerpt. | |
* @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. |
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 opened. | |
add_filter( | |
'the_seo_framework_title_from_generation', | |
function ( $title, $args ) { | |
$is_product = false; |
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_description_excerpt', | |
function ( $excerpt, $args ) { | |
if ( ! strlen( $excerpt ) ) return ''; | |
if ( isset( $args ) ) { | |
$is_term = 'term' === The_SEO_Framework\get_query_type_from_args( $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 | |
// Don't include the PHP opening tag if PHP is already opened in the script. | |
add_filter( 'the_seo_framework_description_excerpt', 'my_custom_meta_description_excerpt', 10, 2 ); | |
/** | |
* @param string $excerpt The excerpt to use. | |
* @param array|null $args The query arguments. Contains 'id', 'tax', 'pta', and 'uid'. | |
* Is null when the query is auto-determined. |
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 | |
/** | |
* Plugin name: test wp_get_wp_version performance. | |
*/ | |
if ( ! function_exists( 'wp_get_wp_version' ) ) { | |
function wp_get_wp_version() { | |
require ABSPATH . WPINC . '/version.php'; | |
return $wp_version; |
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 | |
$request = strtok( substr_replace( $_SERVER['REQUEST_URI'], '', 0, strlen( dirname( $_SERVER['PHP_SELF'] ) ) ), '.' ); | |
$r_parts = array_values( array_filter( explode( '/', $request ) ) ); | |
if ( empty( $r_parts[0] ) ) { | |
http_response_code( 400 ); | |
exit; | |
} |
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/299ad19597f974c89b1564316297c1ed | |
// For: https://wordpress.org/support/topic/fetch-meta-description-on-custom-field-from-meta-box/ | |
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. | |
// 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. |
NewerOlder