If you have the post’s ID, I assume that you are the owner of the blog ( Not because others can’t have the ID, but because only the owner should do such tasks ).
To convert the post ID to the post’s URL, you can use get_the_permalink()
:
$url = get_the_permalink( $id );
Afterward, you can use file_get_contents()
to fetch its content, including the full source of that web page. So, your full code will be:
$url = get_the_permalink( $id );
$data = file_get_contents( $url );
Which data is your HTML source. Note that this will only work in the WordPress environment.
Related Posts:
- dealing with large HTML output via plugin code
- How can I make my custom shortcode work in a Custom HTML Widget?
- Output in XHTML or HTML 5 for plugins?
- Editor not displaying dynamically after clicking on the button
- How to add an attribute to the body tag with a plugin?
- How to make a custom field as an editor in wordpress?
- How to trigger $_GET request within admin plugin page?
- How can I get WordPress to save comments in markdown format?
- Images under 1MB are not being compressed
- How to save Setting pages data to the database?
- How to translate to spanish wordpress hardcoded content/files?
- Can’t access 3rd party API, code works on local server but not on wordpress
- Form tries to download a file on submit
- hide load more button if there are no posts left to display
- How to create a “Most Popular” & “Latest” TAB in WordPress
- How to implement WordPress plugin update that modifies the database?
- WordPress Plugin Development In MVC Architecture, How?
- Customize plugin update “new version is available” text
- category_name not working (not showing up in sql query debug)
- What happens when two plugins have the same 3rd party class included into them?
- add_rewrite_rule, plugin activation and plugin deactivation
- Custom admin column disappearing when using Quick Edit [duplicate]
- Create page when plugin is activated
- Update Multiple Post Meta for the Same Post In One call?
- Allowing Custom Capability to Manage Plugin Options
- wp_insert_user – how to send verification email before logging in
- Custom plugin settings: clicking “save changes” does not display success message
- How can I translate the name of my Plugin for other languages?
- How to load a new template page according to a particular URL?
- How can I filter blog name?
- Logs to check when the plugin was first installed for the first time
- Can a plugin add to header/footer/body content?
- Detect if a plugin was included in a certain page
- Override the core function locate_template
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- Set user ID at time of wp_create_user
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Inserting HTML tag with ACF into shortcode
- How to create custom tables in WordPress using my own plugin?
- How would I go about creating a user ranked post popularity page?
- How to modify WCMP Rest API response?
- Making a Template for a CPT created by a plugin
- Woocommerce dependent plugin
- External CSS in WordPress Plugin [closed]
- User Session and Stored Cookies not get removed
- get 404 when accessing wp-admin/plugin-install.php
- How to Add Custom New Published Post Counter Icon on Top of the WordPress Site [closed]
- Is it necessary to auto delete my WP plugin database tables when users deactivate/delete my plugin?
- Namespaced shortcode?
- How to pass variables to a function argument using add_action [duplicate]
- Activate my plugins via FTP
- Custom post types – remove default post supports through empty array?
- How to insert and call new data in wordpress website database through a plugin
- How to add apply_filter for a class property in plugin
- update_option_{$option} not showing old value
- How to be escape Variables and options when echo?
- Release the plugin in the WordPress repository where redux is used
- Dokan Marketplace store link in single product page
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- Development of plugins to add components like JqueryUI
- plugin enqueue style on all pages
- File Uploader – Upload without adding to Media Library
- What is necessary to secure a WP plugin against direct file access attempts?
- why the wp_register_script doesn’t work for register_activation_hook
- Add a Custom Field in Comment Box next to the Text area
- How do you create a re-useable HTML fragment in wordpress
- Use a custom block in another block
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- GitHub plugins safe to use in my website?
- Personality quiz in wordpress using a plugin
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Why is my shortcode not working?
- Link custom post type to page
- implement checkbox or toggle switch in plugin code
- wp_remote_post To external API multiple values with the same key
- wordpress form not saving or updating
- How to put a maximum real-time users limit
- Custom admin plugin read CSV
- Can we rename a plugin directory for a already launched plugin?
- How can I call functions from a custom plugin?
- How to get short description under heading – Visual Composer [closed]
- plugin installing error
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How can I use wp_ajax_response for front-end error reporting?
- Am I correctly adding styles to plugin?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- how to create table during plugin installation in side a class
- WP_Filesystem usage within a block of code
- Why function hooked using object are executing at all time?
- What is the Object for WP_Error Class?
- How can I use multi Media Uploader in a plugin?
- Gutenberg: Dynamic Block – Show saved data in the editor
- How to fix ‘Call to undefined function do_settings()’ error?
- Any way to hook into WP after a page displays?
- Trying to disable all notifications except for one on woocommerce checkout page with css [closed]
- How to add custom html to the Media > Attachment Details modal?
- manage_{taxonomy}_custom_column not working
- How to be Variables and options must be escaped when echo’d?
- How to override plugin function in code snippets WordPress