Skip to content

Instantly share code, notes, and snippets.

View kpirnie's full-sized avatar
:bowtie:
I may be slow to respond.

Kevin Pirnie kpirnie

:bowtie:
I may be slow to respond.
View GitHub Profile
@kpirnie
kpirnie / functions.php
Created August 13, 2025 18:17
WordPress - REST Request?
/**
* is_rest_request
*
* this method attempts to determine if the current request is for the REST API or not
* based on a fiew factors
*
* @since 7.4
* @access public
* @author Kevin Pirnie <[email protected]>
* @package Protect Your REmote
@kpirnie
kpirnie / functions.php
Created August 13, 2025 18:18
WordPress - Get Current Post
/**
* get_current_post
*
* Static method for getting the current post
*
* @since 7.3
* @access public
* @author Kevin Pirnie <[email protected]>
* @package Kevin's Framework
*
@kpirnie
kpirnie / functions.php
Created August 13, 2025 18:18
WordPress - Get ID from Slug
/**
* get_id_from_slug
*
* This method is utilized for returning the post id from the slug
*
* @since 7.3
* @access public
* @author Kevin Pirnie <[email protected]>
* @package Kevin's Framework
*
@kpirnie
kpirnie / functions.php
Created August 13, 2025 18:19
WordPress - Get All Publilc Post Type URLs
/**
* get_urls
*
* Public method pull to gather all public URLs
*
* @since 7.3
* @access public
* @author Kevin Pirnie <[email protected]>
* @package Kevin's Framework
*
@kpirnie
kpirnie / functions.php
Created August 13, 2025 18:19
WordPress - Attachment Path from URL
/**
* attachment_url_to_path
*
* Static method for getting the physical server path to an image/attachment/file
* based on it's URL
*
* @since 7.3
* @access public
* @author Kevin Pirnie <[email protected]>
* @package Kevin's Framework
@kpirnie
kpirnie / functions.php
Last active August 13, 2025 18:20
WordPress - Are We Really in Admin?
/**
* is_in_admin
*
* Check and see if we are indeed in the admin area of the site
*
* @since 7.4
* @access public
* @static
* @author Kevin Pirnie <[email protected]>
* @package Kevin's Framework
@kpirnie
kpirnie / clp-renew-certs.py
Created September 5, 2025 13:10
CloudPanel.io Renew LE Certificates if the lets-encrypt:renew:certificates does not exist for you.
#!/usr/bin/env python3
import os
import re
import subprocess
import glob
from datetime import datetime, timedelta
from pathlib import Path
VHOSTS_DIR = "/etc/nginx/sites-enabled"