: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (get_post_field('post_content', $post->ID) !='') {
$seopress_get_the_excerpt = wp_trim_words(esc_attr(stripslashes_deep(wp_filter_nohtml_kses(strip_shortcodes(get_post_field('post_content', $post->ID))))), $seopress_excerpt_length);
$seopress_get_the_excerpt = null;
$seopress_get_the_excerpt = null;
if (get_query_var('paged') >='1') {
$seopress_paged = get_query_var('paged');
$seopress_titles_sep_option = get_option("seopress_titles_option_name");
if (isset($seopress_titles_sep_option['seopress_titles_sep']) ) {
$sep = $seopress_titles_sep_option['seopress_titles_sep'];
if(is_single() || is_author()){
$the_author_meta = get_the_author_meta('display_name', $post->post_author);
if (is_single() && has_category()) {
$post_category_array = get_the_terms(get_the_id(), 'category');
$post_category = $post_category_array[0]->name;
if (is_single() && has_tag()) {
$post_tag_array = get_the_terms(get_the_id(), 'post_tag');
$post_tag = $post_tag_array[0]->name;
if (get_search_query() !='') {
$get_search_query = '"'.get_search_query().'"';
$get_search_query = apply_filters('seopress_get_search_query', $get_search_query);
if ($seopress_excerpt !='') {
$seopress_get_the_excerpt = wp_trim_words(esc_attr(stripslashes_deep(wp_filter_nohtml_kses(strip_shortcodes($seopress_excerpt)))), $seopress_excerpt_length);
if (get_post_field('post_content', $post->ID) !='') {
$seopress_get_the_excerpt = wp_trim_words(esc_attr(stripslashes_deep(wp_filter_nohtml_kses(strip_shortcodes(get_post_field('post_content', $post->ID))))), $seopress_excerpt_length);
$seopress_get_the_excerpt = null;
$seopress_get_the_excerpt = null;
$woo_single_cat_html ='';
$woo_single_tag_html ='';
$woo_single_price_exc_tax ='';
if ( class_exists('WooCommerce') ) {
$woo_single_cats = get_the_terms( $post->ID, 'product_cat' );
if ( $woo_single_cats && ! is_wp_error( $woo_single_cats ) ) {
$woo_single_cat = array();
foreach ( $woo_single_cats as $term ) {
$woo_single_cat[] = $term->name;
$woo_single_cat_html = stripslashes_deep(wp_filter_nohtml_kses(join( ", ", $woo_single_cat )));
$woo_single_tags = get_the_terms( $post->ID, 'product_tag' );
if ( $woo_single_tags && ! is_wp_error( $woo_single_tags ) ) {
$woo_single_tag = array();
foreach ( $woo_single_tags as $term ) {
$woo_single_tag[] = $term->name;
$woo_single_tag_html = stripslashes_deep(wp_filter_nohtml_kses(join( ", ", $woo_single_tag )));
$product = wc_get_product($post->ID);
$woo_single_price = wc_get_price_including_tax( $product );
$product = wc_get_product($post->ID);
$woo_single_price_exc_tax = wc_get_price_excluding_tax( $product );
$seopress_titles_template_replace_array = array(
get_bloginfo('description'),
the_title_attribute('echo=0'),
$seopress_get_the_excerpt,
single_cat_title('', false),
wp_trim_words(stripslashes_deep(wp_filter_nohtml_kses(category_description())),$seopress_excerpt_length),
single_tag_title('', false),
wp_trim_words(stripslashes_deep(wp_filter_nohtml_kses(tag_description())),$seopress_excerpt_length),
single_term_title('', false),
wp_trim_words(stripslashes_deep(wp_filter_nohtml_kses(term_description())),$seopress_excerpt_length),
post_type_archive_title('', false),
esc_attr(get_query_var('day')),
esc_attr(get_query_var('monthnum')),
esc_attr(get_query_var('year')),
$seopress_get_the_excerpt,
$woo_single_price_exc_tax,
date_i18n( get_option( 'date_format' )),
current_time(get_option( 'time_format' )),
$seopress_titles_title_template = str_replace($seopress_titles_template_variables_array, $seopress_titles_template_replace_array, $title);
return $seopress_titles_title_template;
// Squirrly SEO Compatibility #3421
add_filter('sq_current_post', 'ampforwp_sq_current_post');
function ampforwp_sq_current_post($post){
if ( 'squirrly' == ampforwp_get_setting('ampforwp-seo-selection') && ampforwp_is_amp_endpoint() && ( ampforwp_is_front_page() || ampforwp_is_blog() ) ){
$post = get_post(ampforwp_get_the_ID());
function ampforwp_modify_archive_title( $title ) {
$title = single_cat_title( '', false );
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
if(!get_the_author() && function_exists('get_the_coauthor_meta'))
$title = '<span class="vcard">' . ampforwp_get_coauthor_meta('display_name') . '</span>';
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
$title = single_term_title( '', false );
add_action( 'pre_amp_render_post', 'ampforwp_modify_archive_title_in_amp');
function ampforwp_modify_archive_title_in_amp() {
add_filter( 'get_the_archive_title', 'ampforwp_modify_archive_title' );
// 27. Clean the Defer issue
// Moved to functions.php
// 28. Properly removes AMP if turned off from Post panel
add_filter( 'amp_skip_post', 'ampforwp_skip_amp_post', 10, 3 );
function ampforwp_skip_amp_post( $skip, $post_id, $post ) {
$ampforwp_amp_post_on_off_meta = get_post_meta( $post->ID , 'ampforwp-amp-on-off' , true );
if( $ampforwp_amp_post_on_off_meta === 'hide-amp' ) {
//30. TagDiv menu issue removed
add_action('init','ampforwp_remove_tagdiv_mobile_menu');
function ampforwp_remove_tagdiv_mobile_menu() {
if( class_exists( 'Mobile_Detect' )) {
remove_action('option_stylesheet', array('td_mobile_theme', 'mobile'));
//31. removing scripts added by cleantalk and
// #525 WordPress Twitter Bootstrap CSS
add_action('amp_init','ampforwp_remove_js_script_cleantalk');
function ampforwp_remove_js_script_cleantalk() {
$current_url = $_SERVER['REQUEST_URI'];
$current_url = explode('/', $current_url);
$current_url = array_filter($current_url);
$amp_check = in_array('amp', $current_url);
if ( true === $amp_check ) {
ampforwp_remove_filters_for_class( 'wp_loaded', 'ICWP_WPTB_CssProcessor', 'onWpLoaded', 0 );
remove_action('wp_loaded', 'ct_add_nocache_script', 1);
//32. various lazy loading plugins Support
add_filter( 'amp_init', 'ampforwp_lazy_loading_plugins_compatibility' );
function ampforwp_lazy_loading_plugins_compatibility() {
// Disable HTTP protocol removing on script, link, img, srcset and form tags.
remove_filter( 'rocket_buffer', '__rocket_protocol_rewrite', PHP_INT_MAX );
remove_filter( 'wp_calculate_image_srcset', '__rocket_protocol_rewrite_srcset', PHP_INT_MAX );
if(function_exists('magplus_after_setup')){
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
if( function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
remove_action( 'template_redirect', 'magplus_pagination_redirect' );
remove_filter( 'the_content', array( $lazyloadxt, 'filter_html' ) );
remove_filter( 'widget_text', array( $lazyloadxt, 'filter_html' ) );
remove_filter( 'post_thumbnail_html', array( $lazyloadxt, 'filter_html' ) );
remove_filter( 'get_avatar', array( $lazyloadxt, 'filter_html' ) );
//Removing bj loading for amp
function ampforwp_remove_bj_load() {
if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) {
add_filter( 'bjll/enabled', '__return_false' );
add_action( 'bjll/compat', 'ampforwp_remove_bj_load' );
add_action('wp','ampforwp_remove_wp_actions',9);
function ampforwp_remove_wp_actions(){
//Disable Crazy Lazy for AMP #751
if( ampforwp_is_amp_endpoint() ){
remove_action( 'wp', array( 'CrazyLazy', 'instance' ) );
// Removing Marfeel plugin which was blocking internal pages of AMP #2423
remove_action('wp', 'render_marfeel_amp_content' );
//33. Google tag manager support added
// Moved to analytics-functions.php
//34. social share boost compatibility Ticket #387
function social_sharing_removal_code() {
remove_filter('the_content','ssb_in_content');
add_action('amp_init','social_sharing_removal_code', 9);
//35. Disqus Comments Support
add_action('ampforwp_post_after_design_elements','ampforwp_add_disqus_support');
function ampforwp_add_disqus_support() {
global $redux_builder_amp;
$display_comments_on = "";
$display_comments_on = ampforwp_get_comments_status();
if ( isset($redux_builder_amp['ampforwp-disqus-layout']) && 'fixed' == $redux_builder_amp['ampforwp-disqus-layout'] ) {
$height = ampforwp_get_setting('ampforwp-disqus-height');
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && 4 != $redux_builder_amp['amp-design-selector'] && $display_comments_on ) {
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
global $post; $post_slug = rawurlencode($post->post_name);
$disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
if( $redux_builder_amp['ampforwp-disqus-host-position'] == 0 ) {
$disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
$disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.rawurlencode(get_permalink()).'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
<section class="amp-wp-content post-comments amp-wp-article-content amp-disqus-comments" id="comments">
height=<?php echo esc_attr($height) ?>
width=<?php echo esc_attr($width) ?>
layout="<?php echo esc_attr($layout) ?>"
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
src="<?php echo esc_url($disqus_url) ?>" title="<?php echo esc_html__('Disqus Comments','accelerated-mobile-pages'); ?>">
<div overflow tabindex="0" role="button" aria-label="Read more"><?php echo esc_html__('Disqus Comments Loading...','accelerated-mobile-pages') ?></div>
add_filter( 'amp_post_template_data', 'ampforwp_add_disqus_scripts' );
function ampforwp_add_disqus_scripts( $data ) {
global $redux_builder_amp;
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && is_singular() ) {
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
// remove direction attribute from the AMP HTMl #541
unset( $data['html_tag_attributes']['dir'] );
// Facebook Comments Support #825
add_action('ampforwp_post_after_design_elements','ampforwp_facebook_comments_support');
function ampforwp_facebook_comments_support() {
global $redux_builder_amp;
if ( 4 != $redux_builder_amp['amp-design-selector'] ) {
echo ampforwp_facebook_comments_markup();
function ampforwp_facebook_comments_markup() {
global $redux_builder_amp;
$facebook_comments_markup = $lang = $locale = '';
$lang = ampforwp_get_setting('ampforwp-fb-comments-lang');
$display_comments_on = "";
$display_comments_on = ampforwp_get_comments_status();
if ( $redux_builder_amp['ampforwp-facebook-comments-support'] && $display_comments_on ) {
$facebook_comments_markup = '<section class="amp-wp-content post-comments amp-wp-article-content amp-facebook-comments" id="comments">';
if(true == ampforwp_get_setting('ampforwp-facebook-comments-title')){
$facebook_comments_markup .= '<h5>'. esc_html__(ampforwp_translation(ampforwp_get_setting('ampforwp-facebook-comments-title'), 'Leave a Comment'),'accelerated-mobile-pages') .'</h5>';
$facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
layout="responsive" '.'data-locale = "'.esc_attr($lang).'"'.' data-numposts=';
$facebook_comments_markup .= '"'. esc_attr($redux_builder_amp['ampforwp-number-of-fb-no-of-comments']). '"';
if(ampforwp_get_data_consent()){
$facebook_comments_markup .= ' data-block-on-consent ';
$facebook_comments_markup .= 'data-href=" ' . esc_url(get_permalink()) . '"';
$facebook_comments_markup .= '></amp-facebook-comments> </section>';
return $facebook_comments_markup;
add_filter( 'amp_post_template_data', 'ampforwp_add_fbcomments_scripts' );
function ampforwp_add_fbcomments_scripts( $data ) {
global $redux_builder_amp;
$facebook_comments_check = "";
$facebook_comments_check = ampforwp_facebook_comments_markup();
if ( $facebook_comments_check && $redux_builder_amp['ampforwp-facebook-comments-support'] && ( is_singular() || ampforwp_is_front_page() ) && ( ampforwp_design_selector() == 1 || ampforwp_design_selector() == 2 || ampforwp_design_selector() == 3 )) {
if ( empty( $data['amp_component_scripts']['amp-facebook-comments'] ) ) {
$data['amp_component_scripts']['amp-facebook-comments'] = 'https://cdn.ampproject.org/v0/amp-facebook-comments-0.1.js';
//37. compatibility with wp-html-compression
function ampforwp_copat_wp_html_compression() {
remove_action('template_redirect', 'wp_html_compression_start', -1);
remove_action('get_header', 'wp_html_compression_start');
if( class_exists('BunnyCDN') ){
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
if( function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
//Remove Action to remove CDN URL from BunnyCDN Plugin
remove_action("template_redirect", "doRewrite");
add_action('amp_init','ampforwp_copat_wp_html_compression');
//38. Extra Design Specific Features
add_action('pre_amp_render_post','ampforwp_add_extra_functions',12);
function ampforwp_add_extra_functions() {
global $redux_builder_amp;
if ( $redux_builder_amp['amp-design-selector'] == 3 ) {
require AMPFORWP_PLUGIN_DIR . '/templates/design-manager/design-3/functions.php';
//38. #529 editable archives
add_filter( 'get_the_archive_title', 'ampforwp_editable_archvies_title' );
function ampforwp_editable_archvies_title($title) {
global $redux_builder_amp;
$ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
if ( $ampforwp_is_amp_endpoint){
$title = single_cat_title( ampforwp_translation($redux_builder_amp['amp-translator-archive-cat-text'], 'Category (archive title)').' ', false );
$title = single_tag_title( ampforwp_translation($redux_builder_amp['amp-translator-archive-tag-text'], 'Tag (archive title)').' ', false );
//39. #560 Header and Footer Editable html enabled script area
add_action('amp_post_template_footer','ampforwp_footer_html_output',11);
function ampforwp_footer_html_output() {
if(true == ampforwp_get_setting('ampforwp-footer-top')){
if( ampforwp_get_setting('amp-footer-text-area-for-html') ) {
echo ampforwp_get_setting('amp-footer-text-area-for-html') ;
//Quantcast Support #4951
if (ampforwp_get_setting('amp-quantcast-notice-switch')) {
$id = $hashcode = $country = $name = '';
$id = ampforwp_get_setting('amp-quantcast-id');
$hashcode = ampforwp_get_setting('amp-quantcast-hashcode');
$country = ampforwp_get_setting('amp-quantcast-publishercountrycode');
$name = ampforwp_get_setting('amp-quantcast-publishername');
$privacy = ampforwp_get_setting('amp-quantcast-privacy-mode');
$lang = ampforwp_get_setting('amp-quantcast-lang');
if (!empty($id) && !empty($hashcode) && !empty($country) && !empty($name) ) {?>
<amp-consent id="quantcast" layout="nodisplay">
<script type="application/json">
"consentInstanceId": "quantcast",
"checkConsentHref": "https://apis.quantcast.mgr.consensu.org/amp/check-consent",
"consentRequired": "remote",
"promptUISrc": "https://quantcast.mgr.consensu.org/tcfv2/amp.html",
"quantcastAccountId": "<?php echo esc_html($id); ?>",
"privacyMode": ["<?php echo esc_html($privacy); ?>"],
"hashCode": "<?php echo esc_html($hashcode); ?>",
"publisherCountryCode": "<?php echo esc_html($country); ?>",
"publisherName": "<?php echo esc_html($name); ?>",
"vendorPurposeIds": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"vendorFeaturesIds": [1, 2, 3],
"vendorPurposeLegitimateInterestIds": [2, 3, 4, 5, 6, 7, 8, 9, 10],
"vendorSpecialFeaturesIds": [1, 2],
"vendorSpecialPurposesIds": [1, 2],
"lang_": "<?php echo esc_html($lang); ?>",
"publisherConsentRestrictionIds": [],
"publisherLIRestrictionIds": [],
"publisherPurposeIds": [],
"publisherPurposeLegitimateInterestIds": [],
"publisherSpecialPurposesIds": [],
"publisherFeaturesIds": [],
"publisherSpecialFeaturesIds": [],
"vendorListUpdateFreq": 30
<!-- PRIVACY BUTTON LOWER RIGHT -->
<button role="button" on="tap:quantcast.prompt()">
<svg style="height:20px">
d="M16 10L15 9C15 9 15 8 15 8L16 7C16 7 16 6 16 6 16
5 15 4 14 3 14 2 13 2 13 3L12 3C12 3 11 3 11 2L11 1C11 1 10 0 10 0 9 0 7 0 6 0 6 0
5 1 5 1L5 2C5 3 4 3 4 3L3 3C3 2 2 2 2 3 1 4 0 5 0 6 0 6 0 7 0 7L1 8C1 8 1 9 1 9L0
10C0 10 0 11 0 11 0 12 1 13 2 14 2 15 3 15 3 14L4 14C4 14 5 14 5 15L5 16C5 16 6 17
6 17 7 17 9 17 10 17 10 17 11 16 11 16L11 15C11 14 12 14 12 14L13 14C13 15 14 15 14
14 15 13 16 12 16 11 16 11 16 10 16 10ZM13 13L12 13C11 13 11 13 9 14L9 16C9 16 7 16 7
16L7 14C5 14 5 13 4 13L3 13C2 13 1 12 1 11L3 10C2 9 2 8 3 7L1 6C1 5 2 4 3 4L4 4C5 4 5
3 7 3L7 1C7 1 9 1 9 1L9 3C11 3 11 4 12 4L13 4C14 4 15 5 15 6L13 7C14 8 14 9 13 10L15
11C15 12 14 13 13 13ZM8 5C6 5 5 7 5 9 5 10 6 12 8 12 10 12 11 10 11 9 11 7 10 5 8 5ZM8
11C7 11 6 10 6 9 6 7 7 6 8 6 9 6 10 7 10 9 10 10 9 11 8 11Z" />
<amp-geo layout="nodisplay">
<script type="application/json">
"<?php echo esc_html($country); ?>": ["<?php echo esc_html($country); ?>"]