Expert Group of programming

Call the post content without loop in WordPress

Posted by : Heycode Tech | Posted in : wordpress, WordPress Functions | Sep 12,2015 | 0 comments

Here is the wordpress core function named : get_post_field($dbcolumn,$postid);is used to get the value from the database, without the loop.

Call any value from database without the loop i.e get post content without the loop.

get_post_field( $field, $post_id, $context );

$field = Database column name
$post_id = Post id
$context (optional)=Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'.

You can use it in anywhere in the wordpress core file.Suppose your page id = 12, and you need the post content of the page id then

echo get_post_field("post_content",12);

Now you can also get any database column value.

Sometime we need to print the any other page title and it’s excerpt content then we use the wordpress query loop so our website becomes delay i.e speedup problem . So we should to use it in file where needed and improve the website speed.

Let me know if need any help or suggestion .


Author information - Heycode Tech

Every world can ask question and my website registered user give the suggestion.

See all posts by Author

Connect to author

Leave a Reply

Your email address will not be published. Required fields are marked *

About us

Heycodetech is a platform where you can ask any questions related to the programming like PHP,jQuery, MYSQL,HTML , CSS and more Here is the Expert group of programming.