diff --git a/lib/Form/PreviewPage.php b/lib/Form/PreviewPage.php index 7bf48cf878..aa3b391287 100644 --- a/lib/Form/PreviewPage.php +++ b/lib/Form/PreviewPage.php @@ -54,7 +54,10 @@ class PreviewPage { ); } - public function renderTitle() { + public function renderTitle($title = null, $id = null) { + if ($id !== $this->wp->getTheId()) { + return $title; + } return __('Sample page to preview your form', 'mailpoet'); } diff --git a/lib/Router/Endpoints/FormPreview.php b/lib/Router/Endpoints/FormPreview.php index 790ae47a39..8c84f8b3f6 100644 --- a/lib/Router/Endpoints/FormPreview.php +++ b/lib/Router/Endpoints/FormPreview.php @@ -35,7 +35,7 @@ class FormPreview { public function view(array $data) { $this->data = $data; $this->wp->addFilter('the_content', [$this,'renderContent'], 10); - $this->wp->addFilter('the_title', [$this->formPreviewPage,'renderTitle'], 10); + $this->wp->addFilter('the_title', [$this->formPreviewPage,'renderTitle'], 10, 2); $this->wp->addFilter('show_admin_bar', function () { return false; }); diff --git a/lib/WP/Functions.php b/lib/WP/Functions.php index 377a43c0f1..ec017caec7 100644 --- a/lib/WP/Functions.php +++ b/lib/WP/Functions.php @@ -272,6 +272,13 @@ class Functions { return get_the_author_meta($field, $userId); } + /** + * @return false|int + */ + public function getTheId() { + return get_the_ID(); + } + /** * @param int|\WP_User $userId */