pan class="time-since" title="Sat, 16 Sep 2023 07:03:00 UTC">2 年 前 tailwind-color-palette 30f7226d9a first commit 2 年 前 tailwindcss 30f7226d9a first commit 2 年 前 thenify 30f7226d9a first commit 2 年 前 thenify-all 30f7226d9a first commit 2 年 前 to-regex-range 30f7226d9a first commit 2 年 前 tr46 30f7226d9a first commit 2 年 前 ts-interface-checker 30f7226d9a first commit 2 年 前 uglify-js 30f7226d9a first commit 2 年 前 underscore 30f7226d9a first commit 2 年 前 upper-case 30f7226d9a first commit 2 年 前 util-deprecate 30f7226d9a first commit 2 年 前 valid-data-url 30f7226d9a first commit 2 年 前 web-resource-inliner 30f7226d9a first commit 2 年 前 webidl-conversions 30f7226d9a first commit 2 年 前 whatwg-url 30f7226d9a first commit 2 年 前 wrap-ansi 30f7226d9a first commit 2 年 前 wrappy 30f7226d9a first commit 2 年 前 y18n 30f7226d9a first commit 2 年 前 yallist 30f7226d9a first commit 2 年 前 yaml 30f7226d9a first commit 2 年 前 yargs 30f7226d9a first commit 2 年 前 yargs-parser 30f7226d9a first commit 2 年 前 .yarn-integrity 30f7226d9a first commit 2 年 前 tum/whitesports - Gogs: Simplico Git Service

Keine Beschreibung

duplicate-post-gutenberg.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Gutenberg (Block editor)/Classic Editor compatibility functions
  4. *
  5. * @package Duplicate Post
  6. * @since 4.0
  7. */
  8. add_filter( 'duplicate_post_get_clone_post_link', 'duplicate_post_classic_editor_clone_link', 10, 4 );
  9. /**
  10. * Edits the clone link URL to enforce Classic Editor legacy support.
  11. *
  12. * @see duplicate_post_get_clone_post_link()
  13. *
  14. * @param string $url The duplicate post link URL.
  15. * @param int $post_id The original post ID.
  16. * @param string $context The context in which the URL is used.
  17. * @param bool $draft Whether the link is "New Draft" or "Clone".
  18. *
  19. * @return string
  20. */
  21. function duplicate_post_classic_editor_clone_link( $url, $post_id, $context, $draft ) {
  22. $post = get_post( $post_id );
  23. if ( ! $post ) {
  24. return $url;
  25. }
  26. if ( isset( $_GET['classic-editor'] ) // phpcs:ignore WordPress.Security.NonceVerification
  27. || ( $draft && function_exists( 'gutenberg_post_has_blocks' ) && ! gutenberg_post_has_blocks( $post ) )
  28. || ( $draft && function_exists( 'has_blocks' ) && ! has_blocks( $post ) ) ) {
  29. if ( 'display' === $context ) {
  30. $url .= '&amp;classic-editor';
  31. } else {
  32. $url .= '&classic-editor';
  33. }
  34. }
  35. return $url;
  36. }