Make WordPress Core


Ignore:
Timestamp:
12/10/2006 05:17:39 PM (18 years ago)
Author:
markjaquith
Message:

Move wp_check_for_changed_slugs() to post.php so it can be called in non-admin contexts. fixes #3461

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r4628 r4637  
    19851985
    19861986
    1987 function wp_check_for_changed_slugs($post_id) {
    1988     if ( !strlen($_POST['wp-old-slug']) )
    1989         return $post_id;
    1990 
    1991     $post = &get_post($post_id);
    1992 
    1993     // we're only concerned with published posts
    1994     if ( $post->post_status != 'publish' || $post->post_type != 'post' )
    1995         return $post_id;
    1996 
    1997     // only bother if the slug has changed
    1998     if ( $post->post_name == $_POST['wp-old-slug'] )
    1999         return $post_id;
    2000 
    2001     $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');
    2002 
    2003     // if we haven't added this old slug before, add it now
    2004     if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) )
    2005         add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']);
    2006 
    2007     // if the new slug was used previously, delete it from the list
    2008     if ( in_array($post->post_name, $old_slugs) )
    2009         delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
    2010 
    2011     return $post_id;
    2012 }
    2013 
    2014 
    20151987function wp_remember_old_slug() {
    20161988    global $post;
Note: See TracChangeset for help on using the changeset viewer.