Best collection of code for your 'functions.php' file

  • As with many others who are now viewing this post, I have been reading various blogs, forums, and discussion groups to learn and improve my WordPress skills. Over the past 12 months I have been on a mission to substitute my use of plugins by adding code to my functions.php file instead.

    While I completely agree that plugins are very useful in many situations, my experience proved that in 90% of usage cases although a plugin might exist, actually utilizing it could create unnecessary complications and compatibility issues. Additionally in a great deal of cases such plugins added menus and other admin elements which I don't want or need.

    More often than not I have found that by analyzing the code of plugins I was able to strip out the piece of code I wanted and hard code it into my functions.php. This provided me with the exact functionality I needed without having to include unnecessary elements.

    So, the purpose of this post is my attempt to engage you, the reader/admin/developer, to share with me and other here any code bits which you find useful and have added to your theme's function.php file to extend or enhance WordPress without utilizing a plugin.

    When you submit a response here please kindly give each code bit a title, let us know if with what version of WordPress you know its compatible with, include whatever description you feel best describes its function and (if applicable) include a link to the original plugin or source where you found the information.

    I am looking forward to all your responses and will of course continually add my own new finds whenever I find them.

    Please vote on the question and any answers you find useful by clicking on the up arrow on the left hand side of the question or answer.

    Pleae add your old, existing findings as well.

    Hi *@NetConstructor*: I'm concerned about this question because it's a "List of X" question the StackExchange people have told us to look out for: My big concern is when I think of your question I can envision an almost infinite number of answers and as such I'm concerned that this question will result in a collection of random answers but nothing definitive. I want to get other's opinions on this before I (vote to) close it though as I don't want to be heavy handed, I just have concerns.

    My vote is either close or make community wiki

    Considering the first 5 answers were by the OP and the question seems more geared at collecting an array of responses rather than a single, definitive answer, this should be a community wiki.

    seems that one can not just modify a question into a wiki. Is this correct?

    Nonetheless this is useful (I have found 2 snippets I will be making heavy use of)if it's to be a community wiki and has to be started fresh to do that maybe we can just move the stuff here there? ... I converted the question into a wiki when I wrote my last comment. Sorry if that caused any confusion. Normally, you (as the OP) can turn a question into a wiki at any time.

    @EAMann thanks... I was looking for that option but was not sure where it was located. Maybe after you converted it I just did not see the option anymore?

    ** - Bingo. Once it's converted, it's converted ... the option is set and disappears from the page.

    I would consider this bad style and prefer plugins. a) They are built by dedicated deveoplers b) they are maintained and easily upgraded. For little custom snippets I recommend the plugin Shortcode Exec PHP which yields a very clean -- and portable -- way to customize your Wordpress.

    while interesting I believe most people would agree that when your developing themes you want things localized within a functions.php file

    @NetConstructor - If you're going to edit others entries, can you please take care when doing so, you spoiled the indentation in my posting, i always make an effort to maintain indentation for readability. I'd also appreciate it if you could take the time to explain edits you make(i couldn't see any reason for your to edit my entry - and there was no edit summary).

    @t31os -- I edited it to keep it consistent with all of the entries

    All answers not related to a theme should be removed. This thread is a good example for bad coding practices.

    I would have to disagree. Question was not related to the theme. All applicable functions.PHP mods are welcome and users should up/down vote accordingly.

    It's interesting that it's not mentioned anywhere that the functions.php file is the one in your theme directory, leading to confusion, such as this:

    I think it'd be better to encourage people to create a custom functionality plugin instead of using their theme's functions.php

    @rarst - Regarding to your comment on closing this thread, isn't this the reason why it's listed in the community wiki?

    @Cor van Noorloos the use of community wiki status had been greatly reduced and discouraged by network. Simply put "it's not really good fit for QA, but it's community wiki!" excuse doesn't fly anymore. Answers here became disorderly and poorly maintained glob, only visited for wow/fun factor. There had been a lot of movement all over network to squash questions like this.

    @rarst - Understandable. Point taken.

    In regards to the closing of this specific "wiki" I vote that this be reopend. Obviously this wiki post is highly popular demonstrated by the fact that it has 30,000 views which is three times the amount of ANY other question or wiki on this site and the topic itself has been up-voted 119 times which is double that of any other question or topic. If you agree in its value please vote to have it reopen by clicking the "reopen" link. The pure number of page views is not an indicator for quality. We should encourage specific questions with specific answers and good coding practices. This thread is the opposite.

    @toscho - that is specifically why this was setup as a wiki and therefore this post is perfectly valid. The point I made in respect to page views was mentioned because this topic obviously is 3X as popular as any other topic on this site. This website is popular specifically due to questions like these and therefore it makes no sense to close it. I don't think one can debate this unless community interest in topics like these has no value towards admins.

    I will add one more comment on here based off some math I just did. There are less than 790 registered users on this website with a rating of "1" or more. Assuming this pool of individuals represents those who actually vote and/or contribute to this site (and 790 being incredibly fair) then 117 people who voted this question up represents 14%+ of all active users who found this topic useful. Vote to reopen the topic please. Discuss it on Meta where people can see your arguments better. :)

  • Enable Hidden Administration Feature displaying All Site Settings

    Tested on: WordPress 3.1 RC3

    This little piece of code does something pretty cool. It will add an additional option to your settings menu with a link to "all settings" which will show you a complete list of all the settings you have within your database related to your WordPress site. The code below will only made this link visible to an administrator user and hide it for all other users.

       function all_settings_link() {
        add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
       add_action('admin_menu', 'all_settings_link');

    Fantastic for development! I use the options table frequently to store DB versions for my plug-ins ... using phpMyAdmin to reset to an old DB version to test an upgrade script is a pain ... this will make it **so much easier**!!!

    You can also get to the same options page (when logged in) by going to yoursite/wp-admin/options.php

  • Modify the Login Logo & Image URL Link

    Tested on: WordPress 3.0.1

    This code will allow you to easily modify the WordPress Login page Logo as well as the href link and title text of this logo.

    add_filter( 'login_headerurl', 'namespace_login_headerurl' );
     * Replaces the login header logo URL
     * @param $url
    function namespace_login_headerurl( $url ) {
        $url = home_url( '/' );
        return $url;
    add_filter( 'login_headertitle', 'namespace_login_headertitle' );
     * Replaces the login header logo title
     * @param $title
    function namespace_login_headertitle( $title ) {
        $title = get_bloginfo( 'name' );
        return $title;
    add_action( 'login_head', 'namespace_login_style' );
     * Replaces the login header logo
    function namespace_login_style() {
        echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';

    EDIT: If you want to use the site logo to replace the login logo, you can use the following to dynamically pull that information (tested on WP3.5):

    function namespace_login_style() {
        if( function_exists('get_custom_header') ){
            $width = get_custom_header()->width;
            $height = get_custom_header()->height;
        } else {
            $width = HEADER_IMAGE_WIDTH;
            $height = HEADER_IMAGE_HEIGHT;
        echo '<style>'.PHP_EOL;
        echo '.login h1 a {'.PHP_EOL; 
        echo '  background-image: url( '; header_image(); echo ' ) !important; '.PHP_EOL;
        echo '  width: '.$width.'px !important;'.PHP_EOL;
        echo '  height: '.$height.'px !important;'.PHP_EOL;
        echo '  background-size: '.$width.'px '.$height.'px !important;'.PHP_EOL;
        echo '}'.PHP_EOL;
        echo '</style>'.PHP_EOL;
  • Include custom post types in the search results.

    function searchAll( $query ) {
     if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); } 
     return $query;
    add_filter( 'the_search_query', 'searchAll' );

    Add your custom post types to your sites main RSS feed by default.

    function custom_feed_request( $vars ) {
     if (isset($vars['feed']) && !isset($vars['post_type']))
      $vars['post_type'] = array( 'post', 'site', 'plugin', 'theme', 'person' );
     return $vars;
    add_filter( 'request', 'custom_feed_request' );

    Include custom post types in "Right Now" admin dashboard widget

    This will include your custom post types and the post counts for each type in the "Right Now" dashboard widget.

    function wph_right_now_content_table_end() {
     $args = array(
      'public' => true ,
      '_builtin' => false
     $output = 'object';
     $operator = 'and';
     $post_types = get_post_types( $args , $output , $operator );
     foreach( $post_types as $post_type ) {
      $num_posts = wp_count_posts( $post_type->name );
      $num = number_format_i18n( $num_posts->publish );
      $text = _n( $post_type->labels->singular_name, $post_type->labels->name , intval( $num_posts->publish ) );
      if ( current_user_can( 'edit_posts' ) ) {
       $num = "<a href='edit.php?post_type=$post_type->name'>$num</a>";
       $text = "<a href='edit.php?post_type=$post_type->name'>$text</a>";
      echo '<tr><td class="first num b b-' . $post_type->name . '">' . $num . '</td>';
      echo '<td class="text t ' . $post_type->name . '">' . $text . '</td></tr>';
     $taxonomies = get_taxonomies( $args , $output , $operator ); 
     foreach( $taxonomies as $taxonomy ) {
      $num_terms  = wp_count_terms( $taxonomy->name );
      $num = number_format_i18n( $num_terms );
      $text = _n( $taxonomy->labels->singular_name, $taxonomy->labels->name , intval( $num_terms ));
      if ( current_user_can( 'manage_categories' ) ) {
       $num = "<a href='edit-tags.php?taxonomy=$taxonomy->name'>$num</a>";
       $text = "<a href='edit-tags.php?taxonomy=$taxonomy->name'>$text</a>";
      echo '<tr><td class="first b b-' . $taxonomy->name . '">' . $num . '</td>';
      echo '<td class="t ' . $taxonomy->name . '">' . $text . '</td></tr>';
    add_action( 'right_now_content_table_end' , 'wph_right_now_content_table_end' );

    Regarding the last snippet to this answer. This is a great addition as I was adding these manually for each post type. The only issue I have with this is that it adds the data after the default "category" and "tag" entry. Could you update your answer to move the default "category" or "tag" ones down or remove them so that they can be added manually? I don't think I understand your request. If I do, then I think it would be a bit more of a difficult thing to do, and don't really have time right now to figure out how to do it.

    Include custom post types in the search results - I guess, now you can do this with `exclude_from_search` param of `register_post_type`...

  • Remove Update Notification for all users except ADMIN User

    Tested on: WordPress 3.0.1

    This code will ensures that no users other than "admin" are notified by WordPress when updates are available..

       global $user_login;
       if ($user_login !== "admin") { // Change admin to the username that gets the updates
        add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
        add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );

    Changed version to only show update notification for admin users (as opposed to just the user 'admin'):

           global $user_login;
           if (!current_user_can('update_plugins')) { // Checks to see if current user can update plugins
            add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
            add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );

    This is far less than ideal. It will only work if the admin's login is still the default 'admin', which it shoudln't be for security reasons. Instead you should check for a specific capability that you want people to have to see messages.

    I.e. if (!current_user_can('manage_options')) {...add_filter...} -- Sorry about double comment, I forgot that hitting enter submits comments)

    Thats why I added the comment to the code where you can change the admin username. How would you improve/rewrite it?

    The best way is to remove the global $user_login and get_currentuserinfo() and instead use current_user_can in your if clause. It's only 1 line instead of 3 and its the standard way. You can check for the specific capability that would be needed to ACT on the messages, in this case there's 'update_core' and 'update_plugins'.

    so: if (!current_user_can('update_plugins')) {/*REMOVE MESSAGES*/}

    so the full code would look like what?

    @Jeremy Clarke so would this code then be the correct way of doing things? But, if you just wanted to allow a specific username to get the notices would the code above be the best way? if (!current_user_can('update_plugins')) { add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); add_filter( 'pre_option_update_core', create_function( '$a', "return null;" )); }

    If you wanted to check for a specific user name I suppose your code in the original answer is acceptable, though there may be a slightly more effective way. The full code using my solution would look like what you have in your last comment. It's the same as your answer but with the current_user_can() check instead of the $user_login !== 'admin'.

    I edited the answer and added the version that uses current_user_can('update_plugins')

    This logic must go inside the core

    I just tried the codes. But I am getting some error page if I use the codes. Same problem with both the codes

    I think this snippet lost it's relevance over the years. In actual WordPress the administrator is the only one who is seeing update notifications.

  • Loading jQuery from the Google CDN

    Tested on: WordPress 3.0.1

    // Even more smart jQuery inclusion :)
    add_action( 'init', 'jquery_register' );
    // Register from Google and for footer
    function jquery_register() {
        if ( !is_admin() ) {
            wp_deregister_script( 'jquery' );
            wp_register_script( 'jquery', ( '' ), false, null, true );
            wp_enqueue_script( 'jquery' );

    Remove the WordPress Version Info for Security

    Tested on: WordPress 3.0.1

    // Remove version info from head and feeds
    function complete_version_removal() {
        return '';
    add_filter('the_generator', 'complete_version_removal');

    Add Spam & Delete Links to Comments on Front End

    Tested on: WordPress 3.0.1

    This makes it way easier to manage comments from the front end by adding spam and delete links.**

    // Spam & delete links for all versions of WordPress
    function delete_comment_link($id) {
        if (current_user_can('edit_post')) {
            echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&c='.$id.'">del</a> ';
            echo '| <a href="'.get_bloginfo('wpurl').'/wp-admin/comment.php?action=cdc&dt=spam&c='.$id.'">spam</a>';

    Delay the public posting to RSS Feed

    Tested on: WordPress 3.0.1

    Finally, I like to delay posting to my RSS feeds for 10-15 minutes because I always find at least a couple errors in my text. Other uses are in case you want content to be exclusive to your site for a day or a week before pushing it out to your RSS readers.

    // Delay feed update
    function publish_later_on_feed($where) {
        global $wpdb;
        if (is_feed()) {
            // Timestamp in WordPress format
            $now = gmdate('Y-m-d H:i:s');
            // Value for wait; + device
            $wait = '10'; // integer
            $device = 'MINUTE'; // MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
            // Add SQL syntax to default $where
            $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
        return $where;
    add_filter('posts_where', 'publish_later_on_feed');

    You can also just remove the generator filter: `remove_action('wp_head', 'wp_generator');`

    Why dont we use google cdn for admin too? I didnt get it

    @Derek Perkins - Can you make each of these code snippets a different answer so they can each be voted on separately? expires after just one hour. **Always** use the full version information like – that expires after one year.

    Can you please split each of these wiki entries up into separate entries within the next few weeks. I wanted to do it for you but I did not want to make it seem like I am trying to take points for information you shared.

    The "Remove the WordPress Version Info for Security" code doesn't actually do anything to increase the security of your site. It doesn't even stop exposure of the WP version being used on your site.

    Not true Joseph, if your WordPress version is exposed then people can see if you are running an older version, thus exposing your vulnerabilities. It is always a good decision to remove that from all WordPress installs. Personally, I don't even know why they put it there in the first place as it IS a security issue.

  • Set a maximum number of post revisions to avoid DB bloat.

    Tested on: WordPress 3.0.1

    The default is infinite, and this will set it to only remember the last five edits:

     * Set the post revisions unless the constant was set in wp-config.php
    if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 5);

    For what it's worth, there are a ton of great ideas for CONSTANTS that can be set on the Codex page Editing wp-config.php.

    Can this be set on a per post type basis?

    Looking at its usage in wp_save_post_revision() there doesn't seem to be a way to distinguish based on post types. There's no filter or anything on the value, though there probably should be.

    thanks Jeremy - To anyone else, if you know how to do this please post it here.

    personally I prefer 10. I know it's double but always when I need a revision it's always older then 5

  • WordPress Profiling tools

    I like to add profiling tools in a separate file, which I then include from functions.php when needed:

        if ( !defined('SAVEQUERIES') && isset($_GET['debug']) && $_GET['debug'] == 'sql' )
            define('SAVEQUERIES', true);
        if ( !function_exists('dump') ) :
             * dump()
             * @param mixed $in
             * @return mixed $in
            function dump($in = null) {
                echo '<pre style="margin-left: 0px; margin-right: 0px; padding: 10px; border: solid 1px black; background-color: ghostwhite; color: black; text-align: left;">';
                foreach ( func_get_args() as $var ) {
                    echo "\n";
                    if ( is_string($var) ) {
                        echo "$var\n";
                    } else {
                echo '</pre>' . "\n";
                return $in;
            } # dump()
         * add_stop()
         * @param mixed $in
         * @param string $where
         * @return mixed $in
        function add_stop($in = null, $where = null) {
            global $sem_stops;
            global $wp_object_cache;
            $queries = get_num_queries();
            $milliseconds = timer_stop() * 1000;
            $out =  "$queries queries - {$milliseconds}ms";
            if ( function_exists('memory_get_usage') ) {
                $memory = number_format(memory_get_usage() / ( 1024 * 1024 ), 1);
                $out .= " - {$memory}MB";
            $out .= " - $wp_object_cache->cache_hits cache hits / " . ( $wp_object_cache->cache_hits + $wp_object_cache->cache_misses );
            if ( $where ) {
                $sem_stops[$where] = $out;
            } else {
            return $in;
        } # add_stop()
         * dump_stops()
         * @param mixed $in
         * @return mixed $in
        function dump_stops($in = null) {
            if ( $_POST )
                return $in;
            global $sem_stops;
            global $wp_object_cache;
            $stops = '';
            foreach ( $sem_stops as $where => $stop )
                $stops .= "$where: $stop\n";
            dump("\n" . trim($stops) . "\n");
            if ( defined('SAVEQUERIES') && $_GET['debug'] == 'sql' ) {
                global $wpdb;
                foreach ( $wpdb->queries as $key => $data ) {
                    $query = rtrim($data[0]);
                    $duration = number_format($data[1] * 1000, 1) . 'ms';
                    $loc = trim($data[2]);
                    $loc = preg_replace("/(require|include)(_once)?,\s*/ix", '', $loc);
                    $loc = "\n" . preg_replace("/,\s*/", ",\n", $loc) . "\n";
                    dump($query, $duration, $loc);
            if ( $_GET['debug'] == 'cache' )
            if ( $_GET['debug'] == 'cron' ) {
                $crons = get_option('cron');
                foreach ( $crons as $time => $_crons ) {
                    if ( !is_array($_crons) )
                    foreach ( $_crons as $event => $_cron ) {
                        foreach ( $_cron as $details ) {
                            $date = date('Y-m-d H:m:i', $time);
                            $schedule = isset($details['schedule']) ? "({$details['schedule']})" : '';
                            if ( $details['args'] )
                                dump("$date: $event $schedule", $details['args']);
                                dump("$date: $event $schedule");
            return $in;
        } # dump_stops()
        add_action('init', create_function('$in', '
            return add_stop($in, "Load");
            '), 10000000);
        add_action('template_redirect', create_function('$in', '
            return add_stop($in, "Query");
            '), -10000000);
        add_action('wp_footer', create_function('$in', '
            return add_stop($in, "Display");
            '), 10000000);
        add_action('admin_footer', create_function('$in', '
            return add_stop($in, "Display");
            '), 10000000);
         * init_dump()
         * @return void
        function init_dump() {
            global $hook_suffix;
            if ( !is_admin() || empty($hook_suffix) ) {
                add_action('wp_footer', 'dump_stops', 10000000);
                add_action('admin_footer', 'dump_stops', 10000000);
            } else {
                add_action('wp_footer', 'dump_stops', 10000000);
                add_action("admin_footer-$hook_suffix", 'dump_stops', 10000000);
        } # init_dump()
        add_action('wp_print_scripts', 'init_dump');
         * dump_phpinfo()
         * @return void
        function dump_phpinfo() {
            if ( isset($_GET['debug']) && $_GET['debug'] == 'phpinfo' ) {
        } # dump_phpinfo()
        add_action('init', 'dump_phpinfo');
         * dump_http()
         * @param array $args
         * @param string $url
         * @return array $args
        function dump_http($args, $url) {
            dump(preg_replace("|/[0-9a-f]{32}/?$|", '', $url));
            return $args;
        } # dump_http()
         * dump_trace()
         * @return void
        function dump_trace() {
            $backtrace = debug_backtrace();
            foreach ( $backtrace as $trace )
                    'File/Line: ' . $trace['file'] . ', ' . $trace['line'],
                    'Function / Class: ' . $trace['function'] . ', ' . $trace['class']
        } # dump_trace()
        if ( $_GET['debug'] == 'http' )
            add_filter('http_request_args', 'dump_http', 0, 2);

    is there a quick way to modify this so that script only gets called when your an administrator AND append something to the URL to show the debug info?

    That's how it's done in my theme: -- the /inc/debug.php is included by /functions.php or /inc/init.php (can't recall off the top of my head).

  • Sharpen Resized Images (only JPEG)

    This function sharpens resized JPEG images. An example of a difference:

    function ajx_sharpen_resized_files( $resized_file ) {
        $image = wp_load_image( $resized_file );
        if ( !is_resource( $image ) )
            return new WP_Error( 'error_loading_image', $image, $file );
        $size = @getimagesize( $resized_file );
        if ( !$size )
            return new WP_Error('invalid_image', __('Could not read image size'), $file);
        list($orig_w, $orig_h, $orig_type) = $size;
        switch ( $orig_type ) {
            case IMAGETYPE_JPEG:
                $matrix = array(
                    array(-1, -1, -1),
                    array(-1, 16, -1),
                    array(-1, -1, -1),
                $divisor = array_sum(array_map('array_sum', $matrix));
                $offset = 0;
                imageconvolution($image, $matrix, $divisor, $offset);
                imagejpeg($image, $resized_file,apply_filters( 'jpeg_quality', 90, 'edit_image' ));
            case IMAGETYPE_PNG:
                return $resized_file;
            case IMAGETYPE_GIF:
                return $resized_file;
        return $resized_file;
    add_filter('image_make_intermediate_size', 'ajx_sharpen_resized_files', 900);

    much much better jpegs, thanks a bunch! tested in 3.4-alpha

    where does this function go?

    @StevieD - as the title suggests, it goes inside functions.php, in your template. I would be careful though, this function is almost 8 years old.

  • Remove Default WordPress Meta Boxes

    Tested on: WordPress 3.0.1

    This code will allow you to remove specific Meta Boxes which WordPress adds by default to the default Add/Edit Post and Add/Edit Page screens.

    function remove_default_post_screen_metaboxes() {
        remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox
        remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox
        remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Metabox
        remove_meta_box( 'trackbacksdiv','post','normal' ); // Talkback Metabox
        remove_meta_box( 'slugdiv','post','normal' ); // Slug Metabox
        remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
    add_action('admin_menu', 'remove_default_post_screen_metaboxes');
    function remove_default_page_screen_metaboxes() {
        remove_meta_box( 'postcustom','page','normal' ); // Custom Fields Metabox
        remove_meta_box( 'postexcerpt','page','normal' ); // Excerpt Metabox
        remove_meta_box( 'commentstatusdiv','page','normal' ); // Comments Metabox
        remove_meta_box( 'trackbacksdiv','page','normal' ); // Talkback Metabox
        remove_meta_box( 'slugdiv','page','normal' ); // Slug Metabox
        remove_meta_box( 'authordiv','page','normal' ); // Author Metabox
    add_action('admin_menu', 'remove_default_page_screen_metaboxes');

    @CorvanNoorloos Your github link is broken.

  • Remove "Wordpress" to "WordPress" filter

    Tested on: WordPress 3.0.1

    There was a filter added with WordPress version 3.0 that automatically converts all instances of "Wordpress" (no capital P) to "WordPress" (with a capital P) in post content, post titles, and comment text. Some people see this as intrusive, but I just have a need to mis-case WordPress from time to time and found the filter somewhat annoying.

    // Remove annoying P filter
    if(function_exists('capital_P_dangit')) {
        foreach ( array( 'the_content', 'the_title' ) as $filter )
            remove_filter( $filter, 'capital_P_dangit', 11 );
        remove_filter('comment_text', 'capital_P_dangit', 31 );

    great little find. One of those things which just removes another piece of code that is not needed

    In WordPress 3.0.1, this filter is added with priority 11, so you need to add `11` as the third parameter to remove it.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM