Skip to content

Instantly share code, notes, and snippets.

View netEmmanuel's full-sized avatar
🦅
Crushing it

Emmanuel Oyelakin netEmmanuel

🦅
Crushing it
View GitHub Profile
@netEmmanuel
netEmmanuel / delete_custom_post_type.php
Created November 14, 2017 14:38 — forked from jazibsawar/delete_custom_post_type.php
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
@netEmmanuel
netEmmanuel / webdev_online_resources.md
Created August 30, 2018 15:53 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@netEmmanuel
netEmmanuel / word_frequency.py
Created April 17, 2020 23:46 — forked from nmpowell/word_frequency.py
Count words in a text file, sort by frequency, and generate a histogram of the top N
#!/usr/bin/python
"""Python script to create a histogram of words in a text file.
Usage: python word_frequency.py -f "/path/to/file.txt" -n 200
Specify the path to the text file as above. Manually specify the top N words to report (default 100).
Text file can contain punctuation, new lines, etc., but special characters aren't handled well.