Skip to content

Commit

Permalink
Merge pull request #2020 from ThemeFuse/issues#25016
Browse files Browse the repository at this point in the history
Page is broken in preview when ID parameter is added in the url
  • Loading branch information
alecszaharia authored Dec 5, 2024
2 parents 830ab2d + 3c1600c commit 262af92
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,35 +409,31 @@ private function initializeAssetLoaders() {
* =====================================================================================================
* =====================================================================================================
*/
function currentPostId() {
$pid = null;
global $wp_query;

if ( isset( $_REQUEST['post'] ) ) {
$pid = (int) $_REQUEST['post'];
} elseif
( isset( $_REQUEST['page_id'] ) ) {
$pid = (int) $_REQUEST['page_id'];
} elseif
( isset( $_REQUEST['post_ID'] ) ) {
$pid = (int) $_POST['post_ID'];
} elseif
( isset( $_REQUEST['id'] ) ) {
$pid = (int) $_REQUEST['id'];
} elseif
( isset( $_REQUEST[ Brizy_Editor::prefix( '_post' ) ] ) ) {
$pid = (int) $_REQUEST[ Brizy_Editor::prefix( '_post' ) ];
} elseif ( $wp_query && $wp_query->is_posts_page ) {
$pid = (int) get_queried_object_id();
} elseif
( $wp_query && ( $apid = get_queried_object_id() ) && ( is_single() || is_page() ) && $wp_query->queried_object instanceof WP_Post ) {
$pid = (int) $apid;
} elseif ( function_exists( 'is_shop' ) && is_shop() ) {
$pid = wc_get_page_id( 'shop' );
}

return $pid;
}
function currentPostId()
{
$pid = null;
global $wp_query;

if ($wp_query && $wp_query->is_posts_page) {
$pid = absint(get_queried_object_id());
} elseif ($wp_query && ($apid = get_queried_object_id()) && (is_single() || is_page()) && $wp_query->queried_object instanceof WP_Post) {
$pid = absint($apid);
} elseif (function_exists('is_shop') && is_shop()) {
$pid = wc_get_page_id('shop');
} elseif (isset($_REQUEST[Brizy_Editor::prefix('_post')])) {
$pid = absint($_REQUEST[Brizy_Editor::prefix('_post')]);
} elseif (isset($_REQUEST['post'])) {
$pid = absint($_REQUEST['post']);
} elseif (isset($_REQUEST['page_id'])) {
$pid = absint($_REQUEST['page_id']);
} elseif (isset($_REQUEST['post_ID'])) {
$pid = absint($_REQUEST['post_ID']);
} elseif (isset($_REQUEST['id'])) {
$pid = absint($_REQUEST['id']);
}

return $pid;
}

static public function get_slug() {
return apply_filters( 'brizy-slug', 'brizy' );
Expand Down

0 comments on commit 262af92

Please sign in to comment.