Post content from another page WordPress

Written by on May 26, 2011 in WordPress - No comments
wordpess

Coding a site for a client in WordPress the other day I came across the need to post the content from one page onto another page. Here is a quick piece of code to paste in your PHP template to do just that (replace the ’123′ with the page-id you are pulling the page content from):

<?php
$my_id = 123;
$post_id_123 = get_post($my_id);
$content = $post_id_123->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>

About the Author

Mike Ilsley "ilz" is a Boston based website designer, front-end developer, WordPress addict, owner of Beantown Design, and exclusive ThemeForest author. Check him out on Twitter, Facebook, Google+ and don't forget to subscribe to the WebDesign&Such email RSS feed. Also, check out his latest project, jQueryMobileShowcase.com.