This file contains hidden or 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
# Redirect "olddomain.com/..." to "newdomain.com/..." URLs at the cache level. | |
# Just set an error code (in our case 750) in vcl_recv when accessing old urls, then define the redirect in vcl_error. | |
# Tested with Varnish 3.X | |
sub vcl_recv { | |
# Set error code when accessing an old url. | |
if (req.http.host ~ "^(www\.)?olddomain\.com$") { | |
error 750; | |
} | |
} |
This file contains hidden or 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
# Backend Server | |
backend default { | |
.host = "XXX.XXX.XXX.XXX"; # IP Address of your Web Server | |
.port = "80"; # Port of your Web Server | |
} | |
# Hosts allowed to purge Varnish | |
acl purge { | |
"localhost"; # Allow varnish to be purged from the same server it is running on | |
"XXX.XXX.XXX.XXX"/24; # IP of your web server that is allowed to purge the cache |
This file contains hidden or 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('pre_get_posts', 'instant_articles_query_modified', 10, 2); | |
function instant_articles_query_modified($query) { | |
if ($query->is_main_query() && null !== INSTANT_ARTICLES_SLUG && $query->is_feed(INSTANT_ARTICLES_SLUG)) { | |
$query->set('cat', 1,2); | |
} | |
} | |
?> |
This file contains hidden or 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 | |
// remove extra tags above the feed which comes from other plugins. | |
add_action('wp_footer', 'remove_extra_code_above_feed', 9); // 9 because by default above plugin functions executes at 10 priority. | |
function remove_extra_code_above_feed() | |
{ | |
if (is_feed()) { | |
// removing these methods because they are generating extra content before the Facebook IA feed. | |
remove_filter('wp_footer', 'gdlr_additional_script'); | |
remove_filter('wp_footer', 'an_prepare'); | |
remove_filter('wp_footer', 'cookielawinfo_inject_cli_script'); |
This file contains hidden or 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 | |
// Sanitizing / replace the table shortcode with the table before the post gets transformed to IA. | |
add_action('instant_articles_before_transform_post', function () { | |
add_filter('the_content', 'sanitize_content_for_ia'); | |
}); | |
function sanitize_content_for_ia($content) { | |
if (in_category(array('videos', 'mehrseitig'))) { | |
$content = preg_replace('@\[sam id=.*?\]@', '', $content); // sam id repalcement |