wordpress help sheet,wordpress实用帮助小抄[持续更新中]

This item was filled under [ wordpress tips ]

get_post_custom()
Get all key/value data for the current post.
get_post_custom_keys()
Get a list of all key names for the current post.
get_post_custom_values($key)
Get the list of values for a particular key on the current post.
get_post_meta($post_id, $key, $single = false)
In WP 1.5 and beyond, this function returns the meta information without cache problems. The function requires the post id, the key, and if $single is set to TRUE, it returns only the first result (NOT as an array) for PHP use.

忘记admin密码,可以这样
修改MD5密码为:”5d41402abc4b2a76b9719d911017c592″,然后使用“hello”登录
得到的字符串,就是加密后的admin。在phpmyadmin里更新下admin帐号的密码为这个新的字段

获取图片地址:

$search = ‘/<img[^\>]*src=\”(.+?)\”.*\/>/’;

$img_arr = ”;

if (preg_match_all($search, $content, $matches, PREG_SET_ORDER))

{

foreach ($matches as $match)

{

$img_arr[] = $match[1];

$content = str_replace($match[0], ”, $content);

}

}

wordpress迁移,数据库修改语句

UPDATE wp_options SET option_value = replace(option_value, ‘old’,'new’) WHERE option_name = ‘home’ OR option_name = ’siteurl’;

UPDATE wp_posts SET post_content = replace(post_content,’old’,'new’);

UPDATE wp_posts SET guid = replace(guid, ‘old’, ‘new’);get_post_custom()
Get all key/value data for the current post.
get_post_custom_keys()
Get a list of all key names for the current post.
get_post_custom_values($key)
Get the list of values for a particular key on the current post.
get_post_meta($post_id, $key, $single = false)
In WP 1.5 and beyond, this function returns the meta information without cache problems. The function requires the post id, the key, and if $single is set to TRUE, it returns only the first result (NOT as an array) for PHP use.

忘记admin密码,可以这样
修改MD5密码为:”5d41402abc4b2a76b9719d911017c592″,然后使用“hello”登录
得到的字符串,就是加密后的admin。在phpmyadmin里更新下admin帐号的密码为这个新的字段

获取图片地址:

$search = ‘/<img[^\>]*src=\”(.+?)\”.*\/>/’;

$img_arr = ”;

if (preg_match_all($search, $content, $matches, PREG_SET_ORDER))

{

foreach ($matches as $match)

{

$img_arr[] = $match[1];

$content = str_replace($match[0], ”, $content);

}

}

wordpress迁移,数据库修改语句

UPDATE wp_options SET option_value = replace(option_value, ‘old’,'new’) WHERE option_name = ‘home’ OR option_name = ’siteurl’;

UPDATE wp_posts SET post_content = replace(post_content,’old’,'new’);

UPDATE wp_posts SET guid = replace(guid, ‘old’, ‘new’);

博客换地址后,解决You do not have sufficient permissions to access this page.的问题。

UPDATE `prefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'wp_', 'prefix_' );

(Make sure you do backups first! Note that the quotes used for string and field name are different.)

In the options table, there is ‘wp_user_roles’, make sure you get that changed into ‘prefix_user_roles’.

UPDATE `prefix_options` SET `option_name` = 'prefix_user_roles' WHERE `option_name` ='wp_user_roles' AND `blog_id` =0;

Bookmark and Share

喜欢这篇文章的人还喜欢。。。

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment