Skip to content

Instantly share code, notes, and snippets.

@rmarcano
rmarcano / IsAccessibleForFree.php
Created June 20, 2025 22:44
Add "IsAccessibleForFree" to the Article schema
/**
* Add the 'isAccessibleForFree' property to Yoast's Article schema.
*
* @param array $data The Article schema data.
* @return array The modified schema data.
*/
function add_is_accessible_for_free_to_article_schema( $data ) {
// Set the property to true. You can change this to false if needed.
$data['isAccessibleForFree'] = true;
@rmarcano
rmarcano / MyShortcodesFilter.js
Created November 19, 2024 17:36
Shortcode analysis.
const getShortcodes = (shortcodes) => {
shortcodes.push("analyze_field");
return shortcodes;
};
wp.hooks.addFilter( "yoast.analysis.shortcodes", "getShortcodes", getShortcodes );
@rmarcano
rmarcano / noindex_single
Created April 11, 2018 14:33
This snippet uses the wpseo_robots filter to add a "noindex, follow" to posts that match a certain condition (in this example, is_single()).
add_filter( 'wpseo_robots', function ( $robots ) {
if ( is_single() ) {
return 'noindex,follow';
}
return $robots;
});