Skip to content

Instantly share code, notes, and snippets.

View gregghenry's full-sized avatar

Gregg Henry gregghenry

View GitHub Profile
@gregghenry
gregghenry / gist:c30c24d2ee47478080c0
Created January 27, 2015 15:51
Hide WP Backend via .htaccess
# BEGIN Hide Backend - Insert this before your default WP url rewrites
# Rules to hide the dashboard
RewriteRule ^/website-login/?$ /wp-login.php [QSA,L]
# END Hide Backend
@gregghenry
gregghenry / delete-cpt-entries.sql
Created April 20, 2016 18:57
Delete Custom Post Type and Post Meta via MySQL
# You made a backup right? Ok....
# I needed this because I had over 100k posts in a CPT and deleting was a pain.
# This doesn't take into account any categories or revisions, so keep that in mind. You can use a plugin to clean those up or edit this to your liking.
# The first select statement you can run to determine if you have the correct records you want to delete.
# Change 'custompost' to whatever your custom post type is called.
SELECT DISTINCT ID, post_title, post_type, post_status
FROM wp_posts a
LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
WHERE a.post_type = 'custompost'
@gregghenry
gregghenry / contactform7.scss
Created October 21, 2016 21:07
default contact form 7 styles in scss form
div {
&.wpcf7 {
margin: 0;
padding: 0;
}
&.wpcf7-response-output {
margin: 2em 0.5em 1em;
padding: 0.2em 1em;
}
@gregghenry
gregghenry / set-featured-image.php
Created March 8, 2017 02:49 — forked from bueltge/set-featured-image.php
Set featureed image automaticly on save post/page
@gregghenry
gregghenry / functions.php
Last active February 1, 2023 15:37 — forked from karrikas/functions.php
Add bootstrap v5 responsive embed to wordpress automatic media embed and iframes
<?php
// Bootstrap 5 version of karrikas WP embed override.
add_filter('embed_oembed_html', 'my_embed_oembed_html', 10, 4);
function my_embed_oembed_html($html, $url, $attr, $post_ID) {
$newHtml = '<div class="ratio ratio-16x9">%s</iframe></div>';
return sprintf($newHtml, $html);
}