| Server IP : 87.229.120.60 / Your IP : 216.73.216.86 Web Server : Apache System : Linux outside 5.4.8_Algonet_ZeroMAC_0.9.4.8 #6 SMP Mon Feb 3 20:36:07 CET 2020 x86_64 User : server ( 1002) PHP Version : 8.3.20 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/faktorteam/www/wp-content/plugins/duplicate-post/compat/ |
Upload File : |
<?php
/**
* Gutenberg (Block editor)/Classic Editor compatibility functions
*
* @package Duplicate Post
* @since 4.0
*/
add_filter( 'duplicate_post_get_clone_post_link', 'duplicate_post_classic_editor_clone_link', 10, 4 );
/**
* Edits the clone link URL to enforce Classic Editor legacy support.
*
* @see duplicate_post_get_clone_post_link()
*
* @param string $url The duplicate post link URL.
* @param int $post_id The original post ID.
* @param string $context The context in which the URL is used.
* @param bool $draft Whether the link is "New Draft" or "Clone".
*
* @return string
*/
function duplicate_post_classic_editor_clone_link( $url, $post_id, $context, $draft ) {
$post = get_post( $post_id );
if ( ! $post ) {
return $url;
}
if ( isset( $_GET['classic-editor'] ) // phpcs:ignore WordPress.Security.NonceVerification
|| ( $draft && function_exists( 'gutenberg_post_has_blocks' ) && ! gutenberg_post_has_blocks( $post ) )
|| ( $draft && function_exists( 'has_blocks' ) && ! has_blocks( $post ) ) ) {
if ( 'display' === $context ) {
$url .= '&classic-editor';
} else {
$url .= '&classic-editor';
}
}
return $url;
}