Making WordPress.org

Changeset 13037


Ignore:
Timestamp:
12/08/2023 05:15:17 AM (3 years ago)
Author:
tellyworth
Message:

Plugin directory: endpoint to toggle preview visibility

See #7251.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-self-toggle-preview.php

    r12933 r13037  
    6666                // Toggle the postmeta value. Note that there is a race condition here.
    6767                $did = '';
    68                 if ( get_post_meta( $plugin->ID, '_no_preview', true ) ) {
    69                         $r = delete_post_meta( $plugin->ID, '_no_preview' );
     68                if ( get_post_meta( $plugin->ID, '_public_preview', true ) ) {
     69                        $r = delete_post_meta( $plugin->ID, '_public_preview' );
     70                        $did = 'disabled';
     71                } else {
     72                        $r = add_post_meta( $plugin->ID, '_public_preview', '1', true );
    7073                        $did = 'enabled';
    71                 } else {
    72                         $r = add_post_meta( $plugin->ID, '_no_preview', '1', true );
    73                         $did = 'disabled';
    7474                }
    7575
Note: See TracChangeset for help on using the changeset viewer.