Disable device preview options in the block editor

In a recent update to WordPress, the following responsive device preview system was added to the Block Editor: Easy to hide them via: .block-editor-post-preview__button-resize { display: none; } But, how can we disable this feature so when you click on the preview button, it opens up a front-end preview of the post on a new tab. Just as it used to be.
Category: Web

After changing wp from subdirectory to root I can't preview any changes to a page or post

I followed the guideline from WP Codex. Changed the site url in general settings Copied the .haccess and the index.php files from the subdirectory to the root Edited the root index.php (new copied file in root) from: '/wp-blog-header.php' ); to '/subdirectory/wp-blog-header.php' ); checked the permalink structure. the following code is in the new copied root .haccess file # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] …
Category: Web

get_post_meta($post->ID) returns empty string when in preview mode of custom post type

I've got my custom post type 'event'. I got tne next code in single-event.php: get_header(); the_post(); echo '<pre>'; echo "$post->ID\n"; var_dump(get_post_meta($post->ID)); echo '</pre>'; When I open my event page by normal URI /event/slug/, I got this: 22681 array(17) { ["_edit_lock"]=> array(1) { [0]=> string(13) "1439329938:36" } ["_edit_last"]=> array(1) { [0]=> string(2) "36" } ... } When I open it for preview, like /event/slug/?preview=true&preview_id=22681&preview_nonce=XXXXXXXXXXXXX , I got only this: 22681 string(0) "" (where first line is a correct post ID and …
Category: Web

I can't preview post's change once they are published

The preview function works fine when posts are just draft. The url looks like this : http://exemple.domain.com/blog/?p=12&preview=true Then when I pubish my posts, let's say I want to change something and preview it, the url looks like this : http://exemple.domain.com/blog/my-article-title/?preview=true&preview_id=12&preview_nonce=514e88946a&post_format=standard The problem is it does reflect any changes ... I use WordPress 3.9.2 running Twenty Fourteen theme without any plugins EDIT I've turn the permalink to default and it resolve the problem. But I need it to work using the …
Category: Web

Change target of view link in admin

We're developing across two sites. One site holds our content, the other actually displays it. So when we are viewing posts in the WP admin, the View link is pointing to the instance it's on, which doesn't help us when we want to view the post. For example, Data site: http://site1.com Viewing site: http://site2.com I need to change our view link on the Data site to something like: http://site2.com/12345 Is there a hook I can use to modify what is …
Category: Web

Getting 401 unauthenticated error in WP Rest API revisions

I'm trying to fetch preview data through WP Rest API using a url such as /wp-json/wp/v2/pages/1140/revisions/1653. An extra header is also included: 'X-WP-Nonce': <nonce> - nonce comes from WP. Why am I getting 401 unauth error? Thanks { code: 'rest_cannot_read', 2020-07-21T11:45:35.930292+00:00 app[web.1]: message: 'Sorry, you are not allowed to view revisions of this post.', 2020-07-21T11:45:35.930293+00:00 app[web.1]: data: { status: 401 } }
Category: Web

Site/Post preview is not working on all social media

I am facing a site preview-related issue. Whenever I paste my site or post a link on social media platform then they must be shown that particular link preview, but except the Facebook, none of the social media platforms are showing any link preview. Such as Twitter, Quora, WhatsApp, etc. This is my site link: https://www.webjanakari.in/ You can pick any of the posts from the website. Rest I have checked OG tags, it is perfectly fine and using Cloudflare SSL.
Category: Web

Live reload preview just reloads forever

There is a new preview feature on WordPress that looks like this: When it's clicked, it reloads the preview over and over and over again. Why would this happen? I tried disabling different plugins and nothing works. I checked my console and tried to grab the errors but I can't because the page reloads over and over again. Is this a known bug? Why is this happening? How do I even start to debug this?
Category: Web

How to remove author name and link from a shared link preview?

I have a weird problem with a wordpress site I'm working on, when we share links for it on discord shared link contains my login name and a link to author posts page (index is a page not a blog page) but when I look at the source there is not a single reference to my login name on the page, also facebook and other social media sites don't have this as there is no metadata about it but somehow …
Category: Web

'Preview Changes' for custom meta boxes?

How can I have the 'Preview Changes' working for custom meta boxes? For instance, I just want to test/ preview some text in a custom meta box but I don't want to save/ update because that post/ page is already gone live. eg: $post_id = $post->ID; $meta = get_post_meta( get_the_ID(), 'meta_tile1_text', TRUE ); var_dump($meta); ?> <p><?php echo $meta;?> </p> This only works when I click 'Update' button in the backend. But it does not when I click 'Preview Changes'. I …
Category: Web

Post preview and oembed provider issue using polylang plugin with subdomains

[ X ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate. [ X ] The issue still exists against the latest master branch of Polylang and the latest WordPress version. [ X ] This bug happens with only Polylang plugin active [ X ] This bug happens with a default WordPress theme active [ X ] I can reproduce this bug consistently Steps to reproduce the issue Ubuntu 20.04 + nginx …
Category: Web

Preview url not working outside wp-admin

So, I created a link in the frontend which allows the user to preview their post. However, when I click on it, it takes me to the published post instead of previewing the changes I made. Here is what I wrote: <a href="<?php echo get_preview_post_link($post->ID) ?>" target="wp-preview-<?php echo $post->ID ?>" id="post-preview"> Preview </a> If I go into wp-admin and preview the post, it works fine.
Category: Web

How to add custom preview urls for some pages?

I use WordPress as a headless CMS through its API. When clicking on Preview it takes me to domain/slug. This works for most of the pages, however there are some pages that are under sub-path domain/sub-path/slug. How to enable the Preview button to take the user to the correct url? I use ACF, could that be utilised somehow to provide optional value for 'sub-path'?
Category: Web

Customizer Appearance Issue

I am developing new WP theme and it's in the phase of beta testing. So, it has succesfully installed and it's working on some sites. But, now there is one problem on particular host server. (shared hosting), on any domain I use. When I make changes in customizer there are occured and visible, but when I navigate in preview window to another page, for example: Sample page, changes made on front page are not registered but they are saved and …
Category: Web

Preview post on frontend before submitting it?

I found a related (old)post here I'm currently using usp pro as a frontend. I'm creating a free pet memorial site, and want the user to just fill out the form, (NO ACCOUNT REQUIRED),and the post is created, which works fine without any issues. BUT there isn't any options to preview the post, only submit it. I really want to give the users many design options, but a preview function are required, but I'm not an expert in php, and …
Category: Web

How can I change preview URL?

How can I change the preview URL in Wordpress? When creating a post in Wordpress, there is a Preview button which takes you to the draft view. Because I have a custom integration of Wordpress and don't use a theme, I would like to change the URL of the preview link. Is this possible? How? Regarding the custom implementation, Wordpress posts are integrated in another framework. I do this by setting WP_USE_THEMES to false, loading wp-config.php and directly accessing the …
Category: Web

Custom post type single page uses the right template in preview mode but shows a different template after being posted

I've been developing a Wordpress theme. I've created a custom post type called blog in functions.php. // Blog Post Type Creation function te_blog_type() { register_post_type("blog", array( "rewrite" => array("slug" => "blogs"), "labels" => array( "name" => "Blogs", "singular_name" => "Blog", "add_new_item" => "Add New Blog", "edit_item" => "Edit Blog" ), "menu-icon" => "dashicons-format-status", "public" => true, "has_archive" => true, "supports" => array( "title", "thumbnail", "editor", "excerpt", "comments" ), "taxonomies" => array("category", "post_tag", "blog_tag") ) ); } add_action("init", "te_blog_type"); It's been …
Category: Web

Showing wordpress theme demo at front end

i am an wordpress developer and i am currently in a project in which i have 15 wordpress responsive themes and can be downloaded by users of my site. In this , i want the feature to show the user previewing the theme. How can set this feature in front end. Any help! Thanks for advance.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.