How To Set Default Attachment Display Settings In WordPress
Using the following snippet, you will be able to set default attachment display settings, alignment, and link in WordPress.
1 2 3 4 5 6 |
function wps_attachment_display_settings() { update_option( 'image_default_align', 'left' ); update_option( 'image_default_link_type', 'none' ); update_option( 'image_default_size', 'large' ); } add_action( 'after_setup_theme', 'wps_attachment_display_settings' ); |
Snippet Source/Credit: WordPress Codex
How To Show All Active Plugins In WordPress
Using the following snippet, you will be able to show all active plugins in WordPress.
1 2 3 4 5 6 7 8 |
function wpse_54742_active_site_plugins() { $the_plugs = get_option('active_plugins'); foreach($the_plugs as $key => $value) { $string = explode('/',$value); // Folder name will be displayed echo $string[0] ."\n"; } } wpse_54742_active_site_plugins(); |
Snippet Source/Credit: Snipplr
How To Rename WordPress Folder
Using the following snippet, you will be able to rename WordPress folder.
1 2 3 4 |
define ( 'WP_CONTENT_FOLDERNAME', 'public' ); define ( 'WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME ); define ( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/' ); define ( 'WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME ); |
Snippet Source/Credit: Snipplr
How To Register Taxonomy For Your WordPress Pages
Using the following snippet, you will be able to register taxonomy for your WordPress pages.
1 2 3 4 5 6 7 8 9 10 11 12 |
add_action( 'init', 'pages_tax' ); function pages_tax() { register_taxonomy( 'things', 'page', array( 'label' => __( 'Things' ), 'rewrite' => array( 'slug' => 'things' ), 'hierarchical' => true, ) ); } |
Snippet Source/Credit: WordPress Codex
How To Remove Image Sizes From Media Upload Gallery In WordPress
Using the following snippet, you will be able to remove image sizes from media upload gallery in WordPress.
1 2 3 4 5 6 7 |
function wps_remove_image_size($sizes) { unset( $sizes['small'] ); unset( $sizes['medium'] ); unset( $sizes['large'] ); return $sizes; } add_filter('image_size_names_choose', 'wps_remove_image_size'); |
Snippet Source/Credit: WPSnipp