| @@ -338,20 +338,23 @@ | ||
| 338 | 338 | |
| 339 | 339 | function bogo_unique_post_slug( $slug, $post_id, $status, $type, $parent, $original ) { |
| 340 | 340 | global $wp_rewrite; |
| 341 | 341 | |
| 342 | - if ( ! bogo_is_localizable_post_type( $type ) ) | |
| 342 | + if ( ! bogo_is_localizable_post_type( $type ) ) { | |
| 343 | 343 | return $slug; |
| 344 | + } | |
| 344 | 345 | |
| 345 | 346 | $feeds = is_array( $wp_rewrite->feeds ) ? $wp_rewrite->feeds : array(); |
| 346 | 347 | |
| 347 | - if ( in_array( $original, $feeds ) ) | |
| 348 | + if ( in_array( $original, $feeds ) ) { | |
| 348 | 349 | return $slug; |
| 350 | + } | |
| 349 | 351 | |
| 350 | - $locale = get_post_meta( $post_id, '_locale', true ); | |
| 352 | + $locale = bogo_get_post_locale( $post_id ); | |
| 351 | 353 | |
| 352 | - if ( empty( $locale ) ) | |
| 354 | + if ( empty( $locale ) ) { | |
| 353 | 355 | return $slug; |
| 356 | + } | |
| 354 | 357 | |
| 355 | 358 | $args = array( |
| 356 | 359 | 'posts_per_page' => 1, |
| 357 | 360 | 'post__not_in' => array( $post_id ), |
| @@ -361,10 +364,11 @@ | ||
| 361 | 364 | |
| 362 | 365 | $hierarchical = in_array( $type, get_post_types( array( 'hierarchical' => true ) ) ); |
| 363 | 366 | |
| 364 | 367 | if ( $hierarchical ) { |
| 365 | - if ( preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $original ) ) | |
| 368 | + if ( preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $original ) ) { | |
| 366 | 369 | return $slug; |
| 370 | + } | |
| 367 | 371 | |
| 368 | 372 | $args['post_parent'] = $parent; |
| 369 | 373 | } |
| 370 | 374 | |
| @@ -370,11 +374,12 @@ | ||
| 370 | 374 | |
| 371 | 375 | $q = new WP_Query(); |
| 372 | 376 | $posts = $q->query( $args ); |
| 373 | 377 | |
| 374 | - if ( empty( $posts ) ) | |
| 378 | + if ( empty( $posts ) ) { | |
| 375 | 379 | $slug = $original; |
| 380 | + } | |
| 376 | 381 | |
| 377 | 382 | return $slug; |
| 378 | 383 | } |
| 379 | 384 | |
| 380 | 385 | ?> |