Making WordPress.org


Ignore:
Timestamp:
04/01/2020 06:41:40 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Allow plugin committers to self-close plugins.

See #1560.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r9651 r9672  
    811811
    812812    /**
     813     * Generates a link to self-close a plugin..
     814     *
     815     * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
     816     * @return string URL to toggle status.
     817     */
     818    public static function get_self_close_link( $post = null ) {
     819        $post = get_post( $post );
     820
     821        return add_query_arg(
     822            array( '_wpnonce' => wp_create_nonce( 'wp_rest' ) ),
     823            home_url( 'wp-json/plugins/v1/plugin/' . $post->post_name . '/self-close' )
     824        );
     825    }
     826
     827    /**
    813828     * Returns the reasons for closing or disabling a plugin.
    814829     *
Note: See TracChangeset for help on using the changeset viewer.