Skip to content

Instantly share code, notes, and snippets.

@jbanety
jbanety / build_pcntl.sh
Last active February 6, 2024 02:50
(Updated) Build PCNTL ext for MAMP PHP 7.4.2
#!/bin/bash
PHP_VERSION=7.4.2
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5
# Dirs
@jazibsawar
jazibsawar / delete_custom_post_type.php
Created October 2, 2017 12:28
WordPress $wpdb: Delete all posts of a custom post type with its associated meta data (taxonomies, post meta) using SQL query & $wpdb
<?php
function delete_custom_posts($post_type = 'post'){
global $wpdb;
$result = $wpdb->query(
$wpdb->prepare("
DELETE posts,pt,pm
FROM wp_posts posts
LEFT JOIN wp_term_relationships pt ON pt.object_id = posts.ID
LEFT JOIN wp_postmeta pm ON pm.post_id = posts.ID
WHERE posts.post_type = %s