I need to get the title from my custom post but its showing from my default post. here is my code. please help.enter image description here


Simply, echo get_the_title( $slide ); the_title(), or get_the_title() will not work here.


It's not inside any custom loop, so the_title(); function won't work here for your custom post. It will go find the post from main query. Try echo get_the_title($slide);.

  • thanks a lot bro – imran khan Sep 11 '19 at 17:47
  • 1
    If it worked, please select as correct answer. Thank you. – Sohan Zaman Sep 11 '19 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.