You should really only need to run this on an existing post, since new posts will be created in the manner you specify.
add_action( 'load-post.php', 'custom_content_conversion' );
function custom_content_conversion()
{
if (! empty($_GET['post']) )
{
// Get the post object
$post = get_post($_GET['post']);
// If the post object has content, store it in the meta field you are using
if (! empty($post->post_content) )
{
update_post_meta($post->ID, 'your_custom_key', $post->post_content);
}
}
}
Related Posts:
- how to limit edit_form_after_title hook to page and post edit only?
- Custom Field in Featured image for A particular post
- Better post meta efficiency?
- Populating a page with content from post custom fields
- Adding buttons to Add New Post and Add New Page
- How to dynamically parse and transform post/page content before displaying it?
- Output Post with ACF Fields into other Post
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Is there a way to know when a page has been updated and do some action only once?
- Using Post ID and Page ID in same function
- Home page: using custom fields for posts and pages
- Determine if page is the Posts Page
- Hook for post and page load
- Keyboard shortcut for updating a page or post?
- Difference between an archive and a page listing posts
- The next_posts_link() works only with original $wp_query
- Using single.php from plugin folder instead of default template folder
- Skipping first 3 posts in wp query
- Callback for wp.autosave.server.triggerSave();
- How can I see a list of pages and post where my custom Gutenberg block is used?
- disable password protected page for logged users
- Action hook ‘wp’ firing twice… why?
- Update all posts automatically when using post_meta
- In what sequence are the hooks fired when a post is “published”?
- Add custom field to all posts in specific category
- Pagination for Pages and Posts
- How to change post status from publish to draft using hook in wordpress?
- Overview with latest edited posts and pages
- Create A Metabox For A Custom Field
- Custom function for “Submit for Review” hook
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Edit menu item title from edit page/post
- Changing my permalink structure – will new layout conflict with existing page?
- How to add a custom field after wp post
- Custom fields on a virtual page
- What Is meta_id In wp_postmeta?
- Get a custom field of all posts on current blog page
- Only display posts after current date
- How can I get a post field value using javascript?
- Private Posts/Pages & Search
- White Blank Page when Updating and Publishing Page/Post
- Posts vs. Pages
- Action hook for new pending posts?
- Can’t get the_content of the parent page from its single post?
- Disable most recent & view all (TABS) on nav-menu.php
- How can I schedule a PAGE to go live at a future date/time?
- Guest Author – How to display posts on /author/ archive page
- Add Word Limit to Posts
- How to insert 2 args into 1 Wp_Query for a slideshow
- Post categories to pages
- How do I do a page break?
- 2 dynamic sidebars registered, not showing up
- How to make default “Privacy Policy Page” a normal page?
- static landing page leading to author specific pages w/ “live” content
- Total number of posts in query (category/tag/author/search results/main page…)
- Is it possible to add a shortcode below post title?
- WordPress 302 Redirect to Random Product/Post/Page
- Automatically set post_parent value
- New Posts and Pages Won’t Save
- Add two custom fields as a default to the “new post” page.
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Why my meta boxes won’t show in front post page?
- Direct some posts to only appear on a specific page
- Automate post update for all posts?
- Changing permalink of WordPress
- Indenting within a blockquote
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post picker custom field on page
- Create a List of Widgets, where each widget holds three attributes
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- Hook when post is set from published to draft?
- Put page on Archived statut after end of publication date
- How to add a block to a category page?
- post and page and custom post type
- Is it possible to query a category with specified posts?
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Permalink base only for posts
- Precedence of page permalinks over woocommerce product category links?
- Auto populate custom fields by post date
- WordPress URL question
- wp query custom orderby not custom field
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Theme does not respect spaces between paragraphs in pages
- Page and Posts loading as index page? Not loading the content
- Custom fields in normal posts
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- Converting Posts to Pages
- 404 error on every post and page other than home
- get next/previous post name
- Get current post’s child page?
- The next_posts_link() works only with original $wp_query
- get_post_meta property of non object
- Which hooks are essential for post templates?
- Limit amount of pages shown in pagination within wp_query
- how to show all type of author posts in author page (SOLVED)
- custom post type single page template not working
- How to make posts appear under pages
- WordPress Page Column Problem [closed]
- What function does the loop of displaying posts?