• Resolved jlev00

    (@jlev00)


    Hi Jeremy –

    I’m trying to find out a little more about how Jetpack Markdown interprets posts containing markdown.

    What I’m seeing is when I import Woocommerce products which contain markdown, the markdown gets converted to HTML on import. The products display correctly, but when I try to edit the imported products I have to edit them as HTML instead of markdown.

    Granted, the markdown I enter when editing manually is being interpreted correctly.

    I tried both with and without the following code:

    add_action('init', 'my_custom_init');
    function my_custom_init() {
        add_post_type_support( 'product', 'wpcom-markdown' );
    }

    but it makes no difference (and I recall reading that this is no longer necessary for Woocommerce products, but I could be mistaken).

    My feeling is that it’s something to do with do_action calls, and so I might have to look at disabling some of these when importing but would appreciate any insight/links/suggestions you could provide.

    https://www.ads-software.com/plugins/jetpack/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jlev00

    (@jlev00)

    Question: is a post marked somehow in the database as being either HTML or markdown?

    Newly-imported products are fine (ie created in markdown), but existing products which have their content updated are remaining-in/being-converted-to HTML.

    Still testing, still happy for any tips/etc.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    The products display correctly, but when I try to edit the imported products I have to edit them as HTML instead of markdown.

    I’m afraid that’s to be expected. It has to do with the way Markdown is stored on your site. In a WordPress database, your post content is stored in the post_content row. That saved content is HTML, ready to be used by WordPress and by your theme to display your post anywhere.

    When you import content using WordPress importer, post_content is copied over.

    Jetpack does not touch that database row. Instead, it creates an additional row, post_content_filtered, where it stores the Markdown content. On save, that Markdown content is converted into HTML and saved in post_content. This way, even if you decide to deactivate Jetpack at some point, you don’t lose any content; your site will still have the data saved in post_content to use in posts.

    When you use Jetpack and open a post in the post editor, Jetpack first looks for a post_content_filtered for that post; if there is one, that’s what you’ll see in the editor. If there is none, you’ll see the regular post_content.

    When you import content using WordPress importer, that additional database row is not copied over; since it’s not part of the standard WordPress database structure, it’s not copied by the importer.

    To solve this issue, you’d have to import the products manually, by doing a dump of the database, and importing that database directly into your new site’s database.

    I hope this clarifies things a bit.

    I recall reading that this is no longer necessary for Woocommerce products

    That’s correct. Jetpack Markdown support is included in WooCommerce itself since version 2.3.0.

    Thread Starter jlev00

    (@jlev00)

    Beautiful. Jeremy thank you so much for the detailed response.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Markdown – imported Woocommerce products’ is closed to new replies.