Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
network_enable_theme example
'enabled-auto-update',
'disabled-auto-update',
)
;
$_SERVER
[
'REQUEST_URI'
]
=
remove_query_arg
(
$temp_args
,
$_SERVER
[
'REQUEST_URI'
]
)
;
$referer
=
remove_query_arg
(
$temp_args
,
wp_get_referer
(
)
)
;
if
(
$action
)
{
switch
(
$action
)
{
case
'enable':
check_admin_referer
(
'enable-theme_' .
$_GET
[
'theme'
]
)
;
WP_Theme::
network_enable_theme
(
$_GET
[
'theme'
]
)
;
if
(
!
str_contains
(
$referer
, '/network/themes.php'
)
)
{
wp_redirect
(
network_admin_url
(
'themes.php?enabled=1'
)
)
;
}
else
{
wp_safe_redirect
(
add_query_arg
(
'enabled', 1,
$referer
)
)
;
}
exit
;
case
'disable':
check_admin_referer
(
'disable-theme_' .
$_GET
[
'theme'
]
)
;
WP_Theme::
network_disable_theme
(
$_GET
[
'theme'
]
)
;
wp_safe_redirect
(
add_query_arg
(
'disabled', '1',
$referer
)
)
;
exit
;