Skip to content

Instantly share code, notes, and snippets.

@hissy
hissy / rscsv-divide-meta-fields.php
Created April 6, 2015 01:29
Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
<?php
/*
Plugin Name: Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
*/
add_filter('really_simple_csv_importer_save_meta', function($meta, $post, $is_update) {
foreach ($meta as $key => $value) {
if (strpos($value, ',') !== false) {
$_value = preg_split("/,+/", $value);
$meta[$key] = $_value;
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active January 11, 2026 23:52
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@inc2734
inc2734 / .php
Created November 11, 2015 01:27
Register custom post type on Habakiri
<?php
function habakiri_child_theme_setup() {
class Habakiri extends Habakiri_Base_Functions {
public function __construct() {
parent::__construct();
add_action( 'init', array( $this, 'register_post_types' ) );
}
/**
* カスタム投稿タイプを定義
<?php
/**
* Smart Custom Fieldsの定義用クラス
* グループごとにメソッドを作ると良い
*
* @link https://2inc.org/blog/2015/03/12/4670/
*/
Class Test_SmartCustomFields {
@westonruter
westonruter / trac-39128-customizer-cross-domain-workaround.php
Last active July 25, 2023 02:37
WordPress Plugin for Customizer Cross-Domain Workaround (Trac #39128)
<?php
/**
* Plugin Name: Customizer Cross-Domain Workaround (Trac #39128)
* Description: Force customizer preview to use siteurl instead of home URL to work around Trac #39128. Temp fix for issue loading customizer preview when home and siteurl have different domains (cross-domain).
* Plugin URI: https://core.trac.wordpress.org/ticket/39128
* Author: Weston Ruter, XWP
* Author URI: https://make.xwp.co/
*
* Copyright (c) 2017 XWP (https://xwp.co/)
*