WIKI使用導(dǎo)航
站長百科導(dǎo)航
站長專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計算
- 微博營銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺
- WIKI程序與應(yīng)用
- 美國十大主機(jī)
WordPress: UnMuify the plugin shared tables:修訂間差異
來自站長百科
(新頁面: In WPMU the runtime muifys the wpdb->prefix, changing it from the default wp_ prefix to wp_x_ where x = 1...n; as this is usually needed to convert plugins that know about a single blog t...) ? |
(沒有差異)
|
2008年9月26日 (五) 13:39的最新版本
In WPMU the runtime muifys the wpdb->prefix, changing it from the default wp_ prefix to wp_x_ where x = 1...n; as this is usually needed to convert plugins that know about a single blog to one that can deal with many.
This normally works fine, but causes issues where a plugin actually wants a global table, not a per blog one.
If you need a plugin to use a global table, then you could either modify the plugin's code to use $wpmuBaseTablePrefix (which is the base table prefix, probably wp_) or you can possibly add lines similar to these at the start and end of the plugin files rather than editing all the code inline:
<?php $normal_table_prefix = $table_prefix; // grab for later $table_prefix = $wpmuBaseTablePrefix; // setting to global base $wpdb->prefix = $wpmuBaseTablePrefix; // setting to glboal base // ... all the plugin code here $table_prefix = $normal_table_prefix; // back to what it was $wpdb->prefix = $normal_table_prefix; // back to what it was unset($normal_table_prefix); // and we're done with this now ?>