本文整理汇总了PHP中_wpseo_activate函数的典型用法代码示例。如果您正苦于以下问题:PHP _wpseo_activate函数的具体用法?PHP _wpseo_activate怎么用?PHP _wpseo_activate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_wpseo_activate函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpseo_network_activate_deactivate
/**
* Run network-wide (de-)activation of the plugin
*
* @param bool $activate True for plugin activation, false for de-activation
*/
function wpseo_network_activate_deactivate($activate = true)
{
global $wpdb;
$original_blog_id = get_current_blog_id();
// alternatively use: $wpdb->blogid
$all_blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
if (is_array($all_blogs) && $all_blogs !== array()) {
foreach ($all_blogs as $blog_id) {
switch_to_blog($blog_id);
if ($activate === true) {
_wpseo_activate();
} else {
_wpseo_deactivate();
}
}
// Restore back to original blog
switch_to_blog($original_blog_id);
}
}
示例2: wpseo_network_activate_deactivate
/**
* Run network-wide (de-)activation of the plugin
*
* @param bool $activate True for plugin activation, false for de-activation.
*/
function wpseo_network_activate_deactivate($activate = true)
{
global $wpdb;
$all_blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
if (is_array($all_blogs) && $all_blogs !== array()) {
foreach ($all_blogs as $blog_id) {
switch_to_blog($blog_id);
if ($activate === true) {
_wpseo_activate();
} else {
_wpseo_deactivate();
}
restore_current_blog();
}
}
}
示例3: wpseo_network_activate_deactivate
/**
* Run network-wide (de-)activation of the plugin
*
* @param bool $activate True for plugin activation, false for de-activation.
*/
function wpseo_network_activate_deactivate($activate = true)
{
global $wpdb;
$network_blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = %d", $wpdb->siteid));
if (is_array($network_blogs) && $network_blogs !== array()) {
foreach ($network_blogs as $blog_id) {
switch_to_blog($blog_id);
if ($activate === true) {
_wpseo_activate();
} else {
_wpseo_deactivate();
}
restore_current_blog();
}
}
}