1

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.

3
  • Try the query directly from PhpMyAdmin (or whatever interface you got).
    – kaiser
    Commented Sep 21, 2012 at 10:38
  • yeah i did....no results and what is this t and tt stand for? im a noob at this... Commented Sep 21, 2012 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
    Commented Sep 21, 2012 at 10:43

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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