Skip to content

Instantly share code, notes, and snippets.

@duogeekdev
duogeekdev / Append post ID at the end of the URL for a custom post type.php
Created May 14, 2015 06:44
Append post ID at the end of the URL for a custom post type
<?php
function change_post_type_link( $link, $post = 0 ){
if ( $post->post_type == 'product' ){
return home_url( 'product/'. $post->post_name .'/'. $post->ID );
} else {
return $link;
}
}
@duogeekdev
duogeekdev / gist:80ced57d29bdd7611ab4
Created May 9, 2015 22:23
Disable JavaScript concatenation
<?php
define( 'CONCATENATE_SCRIPTS', false );
<?php
define ( 'COOKIE_DOMAIN', 'www.domain.com' );
@duogeekdev
duogeekdev / gist:d76884c1a06f56f14298
Created May 9, 2015 22:21
Setup PHP Ini Settings
<?php
/** Turns the output of errors on or off, you really never want this on, you should only view errors by reading the log file. */
ini_set('display_errors', WP_DEBUG_DISPLAY);
/** Tells whether script error messages should be logged to the server's error log or error_log. */
ini_set('log_errors', 'On');
/** http://us.php.net/manual/en/timezones.php */
ini_set('date.timezone', 'America/Indianapolis');
@duogeekdev
duogeekdev / gist:dad0a55257e9b0da2881
Created May 9, 2015 22:19
Custom User / UserMeta Tables
<?php
define( 'CUSTOM_USER_TABLE', $table_prefix . 'custom_users' );
define( 'CUSTOM_USER_META_TABLE', $table_prefix . 'custom_usermeta' );
@duogeekdev
duogeekdev / gist:be159ea4c60bac7a2164
Created May 9, 2015 22:18
Increase PHP Memory Limit
<?php
define( 'WP_MEMORY_LIMIT', '256M' ); // for front end
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // for admin end
<?php
define( 'AUTOSAVE_INTERVAL', 120 ); // in seconds
@duogeekdev
duogeekdev / gist:666c67ec7e2ceceec7d7
Created May 9, 2015 22:16
Override File Permissions
<?php
define( 'FS_CHMOD_FILE', 0755 );
define( 'FS_CHMOD_DIR', 0644 );
@duogeekdev
duogeekdev / gist:578e91895befcc361bc7
Created May 9, 2015 22:14
Allowing Unfiltered WordPress Uploads for Administrators
<?php
define( 'ALLOW_UNFILTERED_UPLOADS', true );
@duogeekdev
duogeekdev / gist:fba8617a16fee41716c1
Created May 9, 2015 22:13
Enabling the "Trash" Feature for Media Files
<?php
define( 'MEDIA_TRASH', true );