Making WordPress.org


Ignore:
Timestamp:
05/21/2019 05:51:33 PM (5 years ago)
Author:
coffee2code
Message:

Markdown Importer: Prevent duplicate importing of handbook landing pages.

Fixes #4466.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-markdown/inc/class-importer.php

    r8788 r8846  
    8484    protected function get_existing_for_post( WP_Post $post ) {
    8585        $key = rtrim( str_replace( $this->get_base(), '', get_permalink( $post->ID ) ), '/' );
    86         if ( empty( $key ) ) {
     86        // Account for potential handbook landing page, which results in an empty $key.
     87        if ( ! $key ) {
     88            if ( in_array( $post->post_name, [ 'handbook', $post->post_type, "{$post->post_type}-handbook" ] ) ) {
     89                $key = $post->post_name;
     90            }
     91        }
     92        if ( ! $key ) {
    8793            $key = 'index';
    8894        }
Note: See TracChangeset for help on using the changeset viewer.