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 "MerchantReturnPolicy" and "deliveryTime" to each product offer for the automatic product schema with SEOPress PRO | |
add_filter('seopress_schemas_auto_product_json', 'sp_schemas_auto_product_json'); | |
function sp_schemas_auto_product_json($json) { | |
// Check if 'offers' exists in the JSON | |
if (!isset($json['offers'])) { | |
return $json; | |
} | |
// Get the product offers |
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
// This snippet will retrieve the votes from the current post handled by KK Star Ratings plugin | |
add_filter('seopress_schemas_auto_recipe_json', 'sp_schemas_auto_recipe_json'); | |
function sp_schemas_auto_recipe_json($json) { | |
$post_id = get_the_ID(); | |
$rating_data = get_post_meta($post_id, '_kksr_avg_default', true); | |
$count = get_post_meta($post_id, '_kksr_count_default', true); | |
if (!empty($rating_data) && !empty($count)) { | |
$json['aggregateRating'] = [ |
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('seopress_schemas_mapping_select', 'sp_schemas_mapping_select'); | |
function sp_schemas_mapping_select($select) { | |
//Add the new group option + option to the list | |
$select['Jet Engine'] = [ | |
'my_new_dynamic_variable_key' => __('My new dynamic variable title', 'wp-seopress-pro'), | |
]; | |
return $select; | |
} |
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 | |
function sp_titles_template_variables_array($array) { | |
$array[] = '%%my-custom-global-variable%%'; | |
return $array; | |
} | |
add_filter('seopress_titles_template_variables_array', 'sp_titles_template_variables_array'); | |
function sp_titles_template_replace_array($array) { | |
// Replace my_jetengine_custom_field with the name of your meta field (to be used with custom database storage) | |
$array[] = esc_attr(wp_strip_all_tags( jet_engine()->listings->data->get_meta( 'my_jetengine_custom_field' ) )); | |
return $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
add_action('seopress_site_audit_after_processs', 'sp_site_audit_after_processs'); | |
function sp_site_audit_after_processs() { | |
//do something | |
} |
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
add_filter('seopress_instant_indexing_permalink', 'sp_instant_indexing_permalink', 10, 2); | |
function sp_instant_indexing_permalink($permalink, $post) { | |
$cpt = get_post_type( $post ) ? get_post_type( $post ) : ''; | |
if ($cpt === 'test') { | |
return false; | |
} | |
return $permalink; | |
} |
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
add_filter('seopress_dashboard_site_overview_tabs', 'sp_dashboard_site_overview_tabs'); | |
function sp_dashboard_site_overview_tabs($tabs) { | |
//Default array | |
// $tabs = [ | |
// 'tab_seopress_analytics' => esc_html__('Google Analytics', 'wp-seopress-pro'), | |
// 'tab_seopress_matomo' => esc_html__('Matomo Analytics', 'wp-seopress-pro'), | |
// 'tab_seopress_ps' => esc_html__('PageSpeed', 'wp-seopress-pro'), | |
// 'tab_seopress_gsc' => esc_html__('Search Console', 'wp-seopress-pro'), | |
// ]; |
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('seopress_site_audit_query', 'sp_site_audit_query', 10, 5); | |
function sp_site_audit_query($args, $batch_size, $offset, $cpt, $cpt_status) { | |
//Pass your WP Query arguments to the $args array | |
//default values | |
$args = [ | |
'posts_per_page' => $batch_size, | |
'offset' => (int)$offset, | |
'post_type' => $cpt, | |
'post_status' => $cpt_status, |
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
add_filter('seopress_sitemaps_xml_news_name', 'sp_sitemaps_xml_news_name'); | |
function sp_sitemaps_xml_news_name($name) { | |
$name = 'My Google News Name'; | |
return $name; | |
} |
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 | |
//Defer JS | |
add_filter('script_loader_tag', 'seopress_add_async_defer', 10, 3); | |
function seopress_add_async_defer($tag, $handle, $src) | |
{ | |
$defer_scripts = array( | |
'global-scripts' | |
); | |
if (in_array($handle, $defer_scripts)) { |
NewerOlder