Making WordPress.org


Ignore:
Timestamp:
04/25/2019 06:31:36 PM (5 years ago)
Author:
coffee2code
Message:

Markdown Importer: Use title defined in manifest if source doc does not define a title (or it was removed via filter).

File:
1 edited

Legend:

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

    r8679 r8680  
    372372            'post_excerpt' => sanitize_text_field( wp_slash( $excerpt ) ),
    373373        );
    374         if ( ! is_null( $title ) ) {
     374        // If no title was extracted from markdown doc, use the value defined in manifest.
     375        if ( is_null( $title ) ) {
     376            $markdown_entry = get_post_meta( $post_id, $this->manifest_entry_meta_key, true );
     377            if ( ! empty( $markdown_entry['title'] ) ) {
     378                $post_data['post_title'] = sanitize_text_field( wp_slash( $markdown_entry['title'] ) );
     379            }
     380        } else {
    375381            $post_data['post_title'] = sanitize_text_field( wp_slash( $title ) );
    376382        }
     383
    377384        wp_update_post( $post_data );
    378385
Note: See TracChangeset for help on using the changeset viewer.