Home > Software design >  how to get data from any specific page like blog page etc
how to get data from any specific page like blog page etc

Time:12-06

I have a wordpress website and there are some page like aboutpage, blogpage, contactpage etc, so my concern is that i want data like title, paragraph from that specific page (blogpage) so how do i get this for better understanding i add some reference image enter image description here enter image description here

how do i get title and content

CodePudding user response:

Can you refer this https://developer.wordpress.org/reference/functions/get_post/

'42' is post id you can get all like title, content, ...

$post   = get_post( 42 );
$output =  apply_filters( 'the_content', $post->post_content );
print_r($post);
  • Related