Welcome, visitor! Log in
 

Source View: wp_unique_post_slug

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
3075                do {
3076                     $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3077                     $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3078                     $suffix++;
3079                } while ( $post_name_check );
3080                $slug = $alt_post_name;
3081           }
3082      }
3083
3084      return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
3085 }
3086
3087 /**
3088  * Truncates a post slug.
3089  *
3090  * @since 3.6.0
3091  * @access private
3092  * @uses utf8_uri_encode() Makes sure UTF-8 characters are properly cut and encoded.
3093  *