Skip to content

Instantly share code, notes, and snippets.

@chwnam
chwnam / customize-permastruct.php
Created July 30, 2021 10:23
Modify CPT URL permastructure
<?php
/**
* Plugin Name: My CPT with custom permalink.
* Description: Change permalink from /cpt/%postname% to /cpt/%post_id%.
*/
add_action( 'init', 'my_cpt_init' );
function my_cpt_init() {
register_post_type(
'my-cpt',
@yermulnik
yermulnik / config.yml
Last active April 14, 2025 02:05
GH CLI multi-account switch
git_protocol: ssh
aliases:
personal: '!cp ~/.config/gh/hosts.yml.personal ~/.config/gh/hosts.yml && gh auth status'
work: '!cp ~/.config/gh/hosts.yml.work ~/.config/gh/hosts.yml && gh auth status'
@JoeyBurzynski
JoeyBurzynski / cloudflare-worker-ip-to-real-client-ip-address.js
Last active April 6, 2025 06:17
Resolving Cloudflare Worker IP Issues [Replace Cloudflare Worker IP with Real Client IP in X-Forwarded-For HTTP Header]
// Cloudflare Worker Sandbox Examples
// Learning here, not intended for production use.
// https://cloudflareworkers.com/#6bc84bcddcf251074b41adba568a9284:https://tutorial.cloudflareworkers.com
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
})
/**