Site icon Hip-Hop Website Design and Development

the way to add submenu merchandise underneath mum or dad menu merchandise with code

Properly, right here is my downside
suppose i’ve a menu like this generated by wp_nav_menu()

house
test- test1, test2
contact
about

check is my customized put up kind

so what i need to do is that if a person/admin publish posts a check put up kind i would like it to robotically add in underneath check as test3.Neglect concerning the publish_test hook i’ve accomplished some analysis and i’m able to go together with the code as follows in my features.php

perform auto_add_service_as_menu() {
    echo 'okay';exit;

}
perform auto_remove_service_from_menu() {
    echo 'okay';exit;
}
add_action( 'publish_test', 'auto_add_service_as_menu' );
add_action( 'trash_test', 'auto_remove_service_from_menu' );

now what i need to do is add test3 which will likely be new check(cpt) put up and its title and hyperlink ought to be robotically added to check menu.
Observe: I do not need something so as to add or take away in admin dashboard or admin menu solely to the person(wp_nav_menu).
So any assist can be useful.Thanks upfront