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
# BEGIN DOMAIN REDIRECT 301 TOWARDS newdomain.com | |
# ADD THE CODE WITHIN YOUR OLDDOMAIN.COM | |
# MODIFY THE www TO YOUR SPECIFIED SUBDOMAIN | |
# IF YOU ARE USING A NAKED DOMAIN, THEN REMOVE !^www\. | |
# IF YOUR NEWDOMAIN RESOLVES TO ANOTHER SUBDOMAIN | |
# THEN USE THAT NEW SUBDOMAIN INSTEAD OF www. | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com | |
RewriteRule (.*) https://www.newdomain\.com/$1 [R=301,L] | |
# USEFUL FOR: |
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 | |
/** | |
* Block markup | |
* | |
* @package MyNamespace\Blocks\MyBlock | |
* | |
* @var array $attributes Block attributes. | |
* @var string $content Block content. | |
* @var WP_Block $block Block instance. |
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 | |
### | |
# The script uses wp post list command to get a list of post IDs from the year 2022 and saves them in a file called post_ids.txt. It then loops through each post ID in the file and adds the tag with ID 47365 to the post using the wp post term add command with the post_tag taxonomy. | |
# Please note that you need to have the post_tag taxonomy registered for posts in your WordPress site and you may need to replace 47365 with the actual ID of the tag you want to add. | |
# | |
# Save the script with a filename like add_tag_to_2022_posts.sh, make it executable using the chmod +x add_tag_to_2022_posts.sh command, and run it by executing ./add_tag_to_2022_posts.sh in your terminal. | |
### | |
# Get all posts from the year 2022 |
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 | |
# Prompt the user to enter a postmeta key to search for | |
read -p "Enter the postmeta key to search for: " postmeta_key | |
# Find all posts with the specified postmeta key | |
post_ids=$(wp post list --format=ids) | |
for id in $post_ids | |
do | |
meta_value=$(wp post meta get $id $postmeta_key --format=json) |
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 | |
/** | |
* Gets an array of recent post IDs based on the number of posts. | |
* | |
* @param int $num_posts The number of recent posts to retrieve. Defaults to 6. | |
* @param int $expiration_time The expiration time for the cache, in seconds. Defaults to 1 hour. | |
* | |
* @return array An array of recent post IDs. | |
*/ |
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
git diff --staged | pbcopy |
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 | |
// List down all the functions assigned to the "the_content" filter hook. | |
function get_the_content_filters() { | |
$filters = array(); | |
ob_start(); | |
the_content(); | |
$output = ob_get_clean(); | |
global $wp_filter; |
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 class="bg-gray-100"> | |
<head> | |
<title>Checksum Generator</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
</head> | |
<body> | |
<div | |
class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8" | |
> |
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 | |
// Disable WordPress core attempts to redirect old posts. | |
add_filter( 'old_slug_redirect_post_id', '__return_zero' ); | |
add_filter( 'redirect_canonical', '__return_empty_string' ); |
OlderNewer