简体   繁体   English

通过url参数更改wordpress主题

[英]change wordpress theme by url parameters

Turns out that I forgot to place a semicolon in my functions.php file and now it crashed the whole site: 原来,我忘了在我的functions.php文件中放置分号,现在它使整个站点崩溃了:

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/content/xx/xxxxxxx/html/wp-content/themes/clean-home/functions.php on line 404

I don't have FTP access, nor cPanel or hosting access, I was edditing the site accross wp-fileManager plugin. 我没有FTP访问权限,也没有cPanel或主机访问权限,我是通过wp-fileManager插件编辑该站点的。

I've lost all hope with this, and Im wondering if there is a way to switch the theme via url parameters? 我对此失去了所有希望,我想知道是否有办法通过url参数切换主题? the admin session is still active. 管理员会话仍处于活动状态。

WordPress uses the following url to activate a theme. WordPress使用以下URL激活主题。

/wp-admin/themes.php?action=activate&stylesheet=twentyfourteen&_wpnonce=71e651d2a3

The only problem is, you need to know the value for the _wponce url parameter. 唯一的问题是,您需要知道_wponce url参数的值。 It might be in your browsers history from a previous request? 它可能是您先前请求中的浏览器历史记录?

I finally solved this the following way: 我终于通过以下方式解决了这个问题:

as this was a shared hosting account, I didn't have access to the site ftp account, but I had access to other site ftp under the same account. 因为这是一个共享的托管帐户,所以我没有访问站点ftp帐户的权限,但可以访问同一帐户下的其他站点ftp。 (client mistaked credentials) (客户错误的凭证)

So, I uploaded the following php file in the other ftp account: 因此,我在另一个ftp帐户中上传了以下php文件:

$out = shell_exec ("cat /dev/null >  /absolute/path/to/functions.php");
echo $out;

and this whiped the functions.php functions which I later updated. 这鞭打了我后来更新的functions.php函数。

I answer my own question if someday it helps someone. 我有一天会回答我自己的问题,是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM