The URL is okay, what you need to add are cookies that authenticate you as the user who is allowed to see the preview. That is basically sending headers. I would start with the HTTP API (WordPress Codex) looking for a method to add additional HTTP headers and set your cookies.
Otherwise – because probably this is somewhat complicated – you could take a look inside the preview code so to see if you can provide a hook to control access to previews. If possible, you can add some secret parameter to the URL which would allow you to preview any page w/o the need of being logged in (and the need of a nonce as it needs to be provided for preview as well).
The result of either the first or the second approach is quite the same, the only difference would be how to trigger it.
Related Posts:
- How can a plugin create a page/form in the front end?
- Looking for WordPress System Diagrams
- How to output message during plugin activation
- How to provide translations for a WordPress TinyMCE plugin?
- Init action hook running late after PayPal’s return url?
- Get specific color from admin color scheme
- Where do I start from
- How do you create a custom edit.php / edit pages page
- Check the Version of an Enqueue’d External Library
- Edit the output of wp_widget_rss_output()
- Change of query var in pre_get_posts not maintained
- Hook for post permalink update
- Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page
- add_menu_page() with function inside a class [duplicate]
- Does WP Have a Function To Generate .htaccess RewriteCond?
- Changing bloginfo description from a plugin
- wp_enqueue_style built in styles
- Overwrite default XMLRPC function from plugin
- WordPress Plugin Setting’s POST
- htmlentities and editing text
- Gutenberg registerFormatType with Multiple Classes
- Best way to notify WordPress plugin users of new release candidates for beta testing?
- How to update total price of completed order in woocommerce? [closed]
- How do I create a custom api endpoint?
- Add tab to profile.php wordpress plugin development
- Sharing a common set of image files for media library, across all sites within multisite
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- wp_localize_script and host/browser cache
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Get a custom table to an array
- Turn off Admin Bar (Toolbar) in backend – no easy way
- Error : “Cannot use object of type WP_Post as array in”
- Replacing Scripts in Admin Load_Scripts
- How to filter content on Save/Publish to add rel=”nofollow” to all external links?
- How to show active version on wordpress.org of a published plugin?
- How should I store a log for my plugin
- How to create database table, add data, update and delete using wpdb via plugins?
- How to modify the comments to be displayed in a post?
- Find out Requires WP tag for a plugin when submitting it
- Extending theme PHP class in plugin
- what is the difference between these phares?
- WP_Query filters
- Plugin Architecture Question: How to avoid using transients
- SSL certificate verify failed
- How to load library scripts in admin from plugins in noConflict wrapper?
- wordpress how to query wp_options table
- rest_no_route on custom API endpoint wordpress
- WP and object persistence (or lack thereof)
- How to only load css for used blocks on frontend
- adding wp-cli commands to plugin: how to document to users?
- Additional classes `undefined` after saving post in Gutenberg
- How do you submit a Gutenberg plugin?
- Bad Request in AJAX
- Creating an empty page programatically
- Multiple API Endpoints (wp_remote_get)
- plugin_dir_url & plugin_basename not working when plugin dir is outside wordpress dir
- How to replace default comments with custom HTML?
- WP nonce field checkbox prints checked=’checked’ outside input field
- Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all
- Make dynamic string translatable
- Creating two tables in database on activation hook
- Adding Custom CSS with PHP
- How to remove/replace current page template?
- How to receive notification of deprecated API elements and functions?
- Using password protection to load different page elements?
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Change reminder email date to 14 days before
- Generating a password-protected front-end page via a plugin
- Woocommerce get_term_by() in transition_post_status hook doesn’t works
- wp_remote_post not working with admin-post.php
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- Adding Amchart Interface to WordPress API
- WordPress Own Rewrite Rules
- Default media uploader is not showing in wordpress website
- Don’t print customizer styles when no setting has been used
- Load custom translation in custom plugin fails
- Buddy Press restrict the capability to edit users
- Plugin with functions inside a class & how to trigger WP CRON
- “Headers Already Sent” Nightmare on Plugin
- add_settings_error on validating plugin options API
- Uncaught ReferenceError: kpoejy is not defined
- Problem to return more than single line captions
- Unable to show a message after plugin activation
- How to get an array out of a nav menu if it’s a plugin?
- Is there better way to do this without duplicating queries?
- How to create a simple plugin which show/hide an html code in wordpress?
- Can I access WordPress API’s from within plugin scripts?
- Is there a way to make is_search() always return false
- Translation of plugin Upload button
- Ajax url value to pass ‘variable’ to use in query
- Apply Filters Causing a 500 Internal Server Error
- Create wordpress dashboard metabox which spans all columns
- add_filter adds output in the head
- How can i add insertion point between inner blocks in my custom block like core blocks
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Calling get_header() with installed FSE theme
- Reinitiate Gutenburg’s blocks using javascript
- Generating Multiple Divi Pages from Database
- Is it smart to require_once wp-admin/includes/plugin.php when you need only one function from it