Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i have a multisite whice i want to separate because its unneccery as two of my sites are on the same DATABASE and all i need is actually the dynamic custom menus which i have built in the main site(to let them be on the other site...)

i have this code from here(wordpress answers): How to duplicate custom menu settings to export to another site

$wpdb->get_results(sprintf("
    select tr.object_id from wp_terms t 
    left join wp_term_taxonomy tt on t.term_id = tt.term_id
    left join wp_term_relationships tr on tt.term_taxonomy_id =     
    tr.term_taxonomy_id
    left join wp_posts p on p.ID=tr.object_id
    left join wp_postmeta m on m.post_id=tr.object_id
    where t.slug ='%s' and tt.taxonomy='nav_menu' group by(ID)
    order by p.menu_order asc LIMIT 200;
    ",$menus));

and it suppose to do the job, but it doesnt....

what it needs to do is to get all the menu items...

im stuck at the moment...

my goal is to use the main site custom menu on the other site through the database.

share|improve this question
    
Try the query directly from PhpMyAdmin (or whatever interface you got). –  kaiser Sep 21 '12 at 10:38
    
yeah i did....no results and what is this t and tt stand for? im a noob at this... –  user1102152 Sep 21 '12 at 10:41
    
Normally that's short for some table/column name. If you write SELECT foo AS tt then basically foo equals tt and can be used instead. Maybe you should update your question and tell from where you got this query and why you think it should work. –  kaiser Sep 21 '12 at 10:43

1 Answer 1

You can use the switch_to_blog() function to temporarily use data from a specific site instead of the current site.

switch_to_blog(1);  // Switch to Site ID 1 //
wp_nav_menu();
restore_current_blog();  // Switch back to Current Site //

restore_current_blog switches back to the current blog's data.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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