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. |
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 | |
// This works on TSF v5.0 and later. | |
add_filter( | |
'the_seo_framework_meta_render_data', | |
function ( $tags_render_data ) { | |
// Remove og:description: | |
unset( $tags_render_data['og: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 | |
// Don't include the PHP opening tag if PHP is already open in the file. | |
add_action( | |
'parse_request', | |
function() { | |
if ( isset( $_GET['fbclid'] ) ) { | |
wp_safe_redirect( home_url( remove_query_arg( 'fbclid' ) ), 301 ); |
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
// Run this script in the browser console, wait for it to complete and show you the testing results. | |
// You must use the following plugin to load the timings... https://gist.github.com/sybrew/f72f58394e62447d9bad61fdcc0bcb1b | |
// Config the constants below | |
const doLoggedIn = false; // whether testing logged in or out. | |
// NOTE: You must manually log in and out in the browser you're testing this! | |
const iterations = 100; // Set iterations. Fewer than 100/50 with/without Opcache is inaccurate. | |
const tick = false; // Whether to display every timestamp recorded on tick. Noisy. |
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: HTML Timer Dump | |
* Description: Dumps HTML timer in meta id=htmltimerdump as late as possible for you to snatch via JS. | |
* Author: Sybre Waaijer | |
* Author URI: https://cyberwire.nl/ | |
* Version: 1.0.0 | |
* License: GLPv3 | |
* | |
* @package HTMLTimerDump |
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: https://wordpress.org/support/topic/the-seo-framework-polylang-post-type-archive-settings-not-translatable/ | |
add_filter( 'the_seo_framework_post_type_archive_meta', 'my_custom_seo_framework_post_type_archive_meta', 10, 2 ); | |
/** | |
* Filters The SEO Framework post type archive meta based on Polylang's language. | |
* | |
* @param array $meta The current post type archive meta : { | |
* 'doctitle' => string |
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: TSF Headless Mode for non-super-admin. | |
* Plugin URI: https://theseoframework.com/ | |
* Description: Enables Headless Mode for The SEO Framework in the admin area for non-admins. | |
* Version: 1.0.0 | |
* Author: Sybre Waaijer | |
* Author URI: https://theseoframework.com/ | |
* License: GPLv3 | |
*/ |
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 tag if PHP is already running... | |
add_filter( 'the_seo_framework_articles_data', '__return_empty_array' ); |
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 this php opening tag if PHP is already running in the script. | |
add_filter( 'the_seo_framework_focus_elements', function( $elements ) { | |
// Add an extra (prepending) pageContent for parsing. In this case, ACF's textarea "intro_text" and input "product_review_note". | |
$elements['pageContent'] = array_merge( | |
[ ':where(.values .acf-field, .inside.acf-fields > .acf-field)[data-name="intro_text"] .acf-input textarea' => 'append' ], | |
[ ':where(.values .acf-field, .inside.acf-fields > .acf-field)[data-name="product_review_note"] .acf-input input' => 'append' ], |
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 tag if PHP is already active. | |
// Request: https://wordpress.org/support/topic/exclude-specific-bbpress-forums-by-id/ | |
add_filter( | |
'the_seo_framework_robots_meta_array', | |
function( $meta, $args, $ignore ) { |