Skip to content

Instantly share code, notes, and snippets.

@seankmchenry
seankmchenry / change_wp_prefix.txt
Created July 13, 2016 05:22
4 Steps for changing your WordPress database table prefix
1. Change table prefix in wp-config.php
2. Change table names. Script below:
RENAME table `wp_commentmeta` TO `new_commentmeta`;
RENAME table `wp_comments` TO `new_comments`;
RENAME table `wp_links` TO `new_links`;
RENAME table `wp_options` TO `new_options`;
RENAME table `wp_postmeta` TO `new_postmeta`;
RENAME table `wp_posts` TO `new_posts`;
@seankmchenry
seankmchenry / widget-skeleton.php
Last active June 28, 2016 18:37
A skeleton for ACF-enabled widgets
<?php
/**
* CTA Widget
*
* @package _s
*/
class CTA_Widget extends WP_Widget {
/**
* Constructor
@seankmchenry
seankmchenry / insert_post_with_image_handling.php
Last active July 19, 2020 18:24
WP Insert Post w/Image Handling
<?php
// Set new post and post ID variables
$args = array(
'post_title' => $post_title,
'post_content' => $post_content,
'post_status' => 'draft',
'post_type' => $post_type
);
$new_post = wp_insert_post( $args );