Skip to content

Instantly share code, notes, and snippets.

View mralaminahamed's full-sized avatar
💻
Always available

Al Amin Ahamed mralaminahamed

💻
Always available
View GitHub Profile
@mralaminahamed
mralaminahamed / functions.php
Created March 19, 2026 18:44
Disable public singular access for the 'arts_service' post type.
<?php
/**
* Disable public singular access for the 'arts_service' post type.
*
* Filters registration arguments to remove front-end exposure, flushes
* rewrite rules on theme activation/switch, and cleans up the admin
* edit screen for a consistent editorial experience.
*
* @package YourChildTheme
*/
@mralaminahamed
mralaminahamed / class-affiliate-role-manager.php
Created March 11, 2026 06:54
class-affiliate-role-manager.php
<?php
/**
* Affiliate Role Manager
*
* Registers a custom 'affiliate' WordPress role, assigns it to existing users
* based on the '_wc_affiliate_status' user meta, and automatically maintains
* role assignment whenever that meta value is created or updated.
* Also provides a utility query to retrieve all non-affiliate users.
*
* @package YourPlugin
@mralaminahamed
mralaminahamed / bash.sh
Created March 1, 2026 06:20
Create a new plugin from codexprt boilerplate
cpb() {
read -r -p 'Type (1: Classic / 2: Basic / 3: Modern): ' type
read -r -p 'Name: ' name
read -r -p 'Slug: ' slug
read -r -p 'Package: ' package
read -r -p 'Prefix: ' prefix
read -r -p 'Constant: ' constant
read -r -p 'Description: ' description
@mralaminahamed
mralaminahamed / zsh.sh
Created March 1, 2026 06:20
Create new plugin from Codexprt boilerplate
cpb() {
local type name slug package prefix constant description
print -n 'Type (1: Classic / 2: Basic / 3: Modern): ' && read -r type
print -n 'Name: ' && read -r name
print -n 'Slug: ' && read -r slug
print -n 'Package: ' && read -r package
print -n 'Prefix: ' && read -r prefix
print -n 'Constant: ' && read -r constant
print -n 'Description: ' && read -r description
@mralaminahamed
mralaminahamed / duplicate-portfolio-items-film-and-television.php
Created February 16, 2026 22:53
Duplicate Portfolio Items from Artist List for Film and Television
<?php
/**
* Duplicate arts_portfolio_item post ID 433 for each title in the list
*
* Run this code ONLY ONCE in a WordPress environment (e.g., via Code Snippets plugin,
* temporary mu-plugin, or custom admin page).
* After successful execution, deactivate or remove the code.
*/
if (!defined('ABSPATH')) {
@mralaminahamed
mralaminahamed / duplicate-portfolio-items-mixing-and-production.php
Last active February 16, 2026 22:52
Duplicate Portfolio Items from Artist List for Mixing and Production
<?php
/**
* Duplicate arts_portfolio_item post ID 1277 for each artist in the list
* Run this code ONLY ONCE — preferably in a temporary mu-plugin or Code Snippets
* After execution, remove or comment out the code to prevent accidental re-runs.
*/
if (!defined('ABSPATH')) {
exit;
}
@mralaminahamed
mralaminahamed / update-admin-email.php
Created January 16, 2026 02:13
update new admin email to admin email option forcely
<?php
$new_admin_email = get_option( 'new_admin_email' );
if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) {
update_option( 'admin_email', $new_admin_email );
delete_option( 'new_admin_email' );
}
<?php
// Function to track and set post views
function set_post_views($post_id) {
if (!is_single()) return; // Only track on single post views
$count_key = 'post_views_count';
$count = get_post_meta($post_id, $count_key, true);
if ($count == '') {
$count = 0;
delete_post_meta($post_id, $count_key);
add_post_meta($post_id, $count_key, '0');
@mralaminahamed
mralaminahamed / gist:5b65ee92429137fcf9c0946a86dade86
Created September 27, 2025 07:49 — forked from marrisonlab/gist:2d2b1e2423312076256e9def70ff931a
Display Dokan Vendor meta in single product page and loop
/**
* Snippet unificato Dokan + Vendor
* Funziona sia con ID utente generico che con loop prodotto
* WPCode: PHP Snippet → Run Everywhere
*/
if ( ! function_exists( 'sn_get_product_from_context' ) ) {
function sn_get_product_from_context() {
global $product;
if ( isset( $product ) && is_object( $product ) ) return $product;

Our lives are increasingly intertwined with technology, the storage space on our devices becomes a valuable commodity. Mac users often find themselves grappling with the perennial issue of managing storage space efficiently. Accumulated files, applications, and system clutter can clog up your Mac's storage, slowing down performance and hindering productivity.

In this guide, we'll use the built-in Terminal app to free up space on your Mac without using any third-party software.

1. Empty the Trash

Start by emptying the Trash. Even though this can be done through the Finder, you can also do it via Terminal using the rm command.

sudo rm -rf ~/.Trash/*