plugin development – Showing Home option in dropdown when there is no Home page exist
I am developing a plugin and in the admin side, I need to show a dropdown with options of all types of pages and posts etc. Its kind of a visibility option for a widget to be displayed on pages selected by users.
Now I have three main sections:
- Posts (auto-fill all posts when typing)
- Pages (auto-fill all pages when typing)
In each section above, the admin can target where the widget/component should be displayed.
My question is:
How to include the home page in the above section when the default home page is showing Posts and not any custom static page? What is actually home page ID in that case? When I print
get_the_ID(); both return latest post ID on the home page. Why is it like that?
Leave an answer