$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Add a navigation menu item using MySQL|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Add a navigation menu item using MySQL

matteradmin8PV0评论

I want to insert Wordpress nav menu items into MySQL using PHP. I dont think i can use wp_create_nav_menu() because I need to build a preliminary menu from the categories (over 100 cats!) then a lower level admin can modify/adjust/refine. I dont think the wp_create_nav_menu() actually updates the MySQL db's.

I can surely figure this out but just wondering if someone can give me a head start.

Update wp_posts 
Update wp_term_relationships
update wp_term_taxonomy
update wp_terms

set             "post_author" => 1, 
                "post_date" => '2017-12-15 09:37:18', 
                "post_date_gmt" => '2017-12-15 09:37:18', 
                "post_content" => '', 
                "post_title" => 'Storage', 
                "post_excerpt" => '', 
                "post_status" => 'publish', 
                "comment_status" => 'closed', 
                "ping_status" => 'closed', 
                "post_password" => '', 
                "post_name" => 'home-garden-kitchen', 
                "to_ping" => '', 
                "pinged" => '', 
                "post_modified" => '2018-12-03 14:29:13', 
                "post_modified_gmt" => '2018-12-03 20:29:13', 
                "post_content_filtered" => '', 
                "post_parent" => 0, 
                "menu_order" => 97, 
                "post_type" => 'nav_menu_item',     
                "post_mime_type" => '', 
                "comment_count" => 0

etc, etc...

I want to insert Wordpress nav menu items into MySQL using PHP. I dont think i can use wp_create_nav_menu() because I need to build a preliminary menu from the categories (over 100 cats!) then a lower level admin can modify/adjust/refine. I dont think the wp_create_nav_menu() actually updates the MySQL db's.

I can surely figure this out but just wondering if someone can give me a head start.

Update wp_posts 
Update wp_term_relationships
update wp_term_taxonomy
update wp_terms

set             "post_author" => 1, 
                "post_date" => '2017-12-15 09:37:18', 
                "post_date_gmt" => '2017-12-15 09:37:18', 
                "post_content" => '', 
                "post_title" => 'Storage', 
                "post_excerpt" => '', 
                "post_status" => 'publish', 
                "comment_status" => 'closed', 
                "ping_status" => 'closed', 
                "post_password" => '', 
                "post_name" => 'home-garden-kitchen', 
                "to_ping" => '', 
                "pinged" => '', 
                "post_modified" => '2018-12-03 14:29:13', 
                "post_modified_gmt" => '2018-12-03 20:29:13', 
                "post_content_filtered" => '', 
                "post_parent" => 0, 
                "menu_order" => 97, 
                "post_type" => 'nav_menu_item',     
                "post_mime_type" => '', 
                "comment_count" => 0

etc, etc...

Share Improve this question edited Dec 4, 2018 at 17:50 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Dec 4, 2018 at 17:20 Jim VanPettenJim VanPetten 1093 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

My Bad, wp_create_nav_menu() does insert MySQL

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far