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'm using WPtouch Pro to create a mobile theme for my wordpress installation. I've activated it, but the custom menus I've created don't show up in menus drop down.

Note that I'm using a different database table prefix than the default wp_.

How can I get them to show up?

share|improve this question
    
Close-voted as too localized. This question involves a commercial product for which WPSE community members cannot access the code, and the answer to which would be useful to too few people. Such questions are probably better-suited for the commercial developer's support. –  Chip Bennett Apr 13 '12 at 16:43
    
The code is completely accessible. Installing the plugin gives you access to the code. You can access the code before paying for it. I'm posting this so that anyone else who has this problem(and google searches reveal this issue to have existed for more than a year) can find a workaround publicly instead of behind a login wall on the developers's support site. I believe this question and answer serves the purpose of 'making the internet better' –  Tilendor Apr 13 '12 at 17:04
    
Secondly I'm not asking anyone to do any work answering the question. I found the answer. All I wanted to do it share it, which is what Stack Exchange is all about. This question is not harmful, let it be useful to someone. Please don't close it. –  Tilendor Apr 13 '12 at 20:51
add comment

1 Answer 1

There are two solutions.

The simplest is have you database tables start with wp_.

Of course that is't always an option, for example a multi-site install or a situation where you don't control the host environment.

I looked around other parts of the code, and they use {$wpdb->base_prefix} when constructing the SELECT queries, but for the case of the custom menus the wp_ prefix is hard coded.

The offending line is #443 in admin/admin-panel.php

It is currently:

$menus = $wpdb->get_results( "SELECT term_taxonomy_id,a.term_id,name FROM wp_term_taxonomy as a,wp_terms as b WHERE a.taxonomy = 'nav_menu' AND a.term_id = b.term_id" );

To fix it I changed it to this:

$menus = $wpdb->get_results( "SELECT term_taxonomy_id,a.term_id,name FROM {$wpdb->base_prefix}term_taxonomy as a,{$wpdb->base_prefix}terms as b WHERE a.taxonomy = 'nav_menu' AND a.term_id = b.term_id" );

And bam, it worked. I've posted this to wptouch's support board, and someone responded saying they would pass it on to the developers.

This problem also appears to effect multi-site wordpress installations.

share|improve this answer
    
That would be because they hard-coded the prefix of the table as 'wp_' - which is not the always the prefix in multi-sites and more generally any installation that is using a different prefix. –  Stephen Harris Apr 13 '12 at 18:26
add comment

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.