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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>example.com</title> | |
<style> | |
body, html { | |
height: 100%; | |
margin: 0; |
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 | |
/** | |
* Special condition: If your WordPress has a settings to automatically approve all comments without a manual approval | |
* In this case, Cloudflare plugin may not purge the cache. | |
* This is a quick-workaround. After adding this snippet, | |
* you need to create a rule to bypass the Cache for comment-posted=true query string | |
*/ | |
add_filter( 'comment_post_redirect', 'redirect_after_comment' ); | |
function redirect_after_comment( $location ) { |
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
Google Public DNS (8.8.8.8, 8.8.4.4) | |
https://dns.google/cache | |
Cloudflare DNS (1.1.1.1, 1.0.0.1) | |
https://1.1.1.1/purge-cache/ | |
OpenDNS (208.67.222.222, 208.67.220.220) |
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 // Exclude this opening tag. | |
/** | |
* The template_redirect action hook allows pre-template actions. | |
* We set s-maxage to 0 to ensure CDNs fetch fresh content, | |
* assuming the CDN respects existing headers. | |
*/ | |
add_action('template_redirect', function () { | |
header('cache-control: s-maxage=0'); | |
}); |
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
/** | |
* News Summary: Display the most important information first. | |
* | |
* This code snippet adds a custom meta box called "News Summary" in the Post editor. | |
* The meta box allows users to input a summary for each post, which will be displayed | |
* at the beginning of the post's content on the single post page. | |
*/ | |
// Register the Summary Meta Box | |
function custom_news_summary_meta_box() { |
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
wp post list --post_type=post --format=ids --allow-root | xargs wp post update --post_status=draft --allow-root | |
or | |
wp post update $(wp post list --post_type=post --format=ids --allow-root) --post_status=draft --allow-root |
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
#!/bin/bash | |
# Define variables | |
WORDPRESS_ABSPATH="/var/www/html" | |
BUNNYCDN_EDGE_STORAGE_ZONE_URL="https://storage.bunnycdn.com" | |
BUNNYCDN_EDGE_STORAGE_NAME="example-org-backup" | |
BUNNYCDN_EDGE_STORAGE_PASSWORD="ENTER-STORAGE-SPECIFIC-PASSWORD-HERE-NOT-ACCOUNT-API" | |
# Check if WP CLI is installed |
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
server { | |
listen 80; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
# Document Root | |
root /var/www/html; | |
index index.php index.html index.htm; | |
server_name demo.gulshankumar.net; | |
client_max_body_size 0; |
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
function remove_block_css() { | |
wp_dequeue_style( 'wp-block-library' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'remove_block_css', 20 ); | |
// disable for posts | |
add_filter('use_block_editor_for_post', '__return_false', 10); | |
// disable for post types | |
add_filter('use_block_editor_for_post_type', '__return_false', 10); |
NewerOlder