軟件介紹
WordPress優(yōu)化版是一款專為每一個(gè)博主和網(wǎng)站建設(shè)者帶來(lái)一個(gè)全新的網(wǎng)站的建設(shè),這里有著豐富的建設(shè)方式,全新的素材內(nèi)容讓你的網(wǎng)站快速完成建設(shè),帶給你最簡(jiǎn)單的創(chuàng)建方式。WordPress電腦版適用于各個(gè)精彩行業(yè),網(wǎng)站建設(shè)、博客論壇、營(yíng)銷網(wǎng)頁(yè)等等,用戶在這里根據(jù)自己的喜好去創(chuàng)建,沒(méi)有任何的復(fù)雜程度,輕松構(gòu)建。
WordPress讓你在這里完成全新的創(chuàng)建方式,精彩的圖文排版,無(wú)需任何的專業(yè)代碼,也不需要手冊(cè),小白也能根據(jù)步驟一步一步完成創(chuàng)建,不受你的約束。
WordPress優(yōu)化版特色
1.文章發(fā)布、分類、歸檔、收藏,統(tǒng)計(jì)閱讀次數(shù)。
2.提供文章、評(píng)論、分類等多種形式的聚合。
3.提供鏈接的添加、歸類功能。
4.支持評(píng)論的管理,垃圾信息過(guò)濾功能。
5.支持多樣式CSS和PHP程序的直接編輯、修改。
6.在Blog系統(tǒng)外,方便的添加所需頁(yè)面。
7.通過(guò)對(duì)各種參數(shù)進(jìn)行設(shè)置,使Blog更具個(gè)性化。
8.在某些插件的支持下實(shí)現(xiàn)靜態(tài)html頁(yè)面生成(如WP-SUPER-CACHE)。
9.通過(guò)選擇不同主題,方便地改變頁(yè)面的顯示效果。
10.通過(guò)添加插件,可提供多種特殊的功能。
11.支持Trackback和pingback。
12.支持針對(duì)某些其它blog軟件、平臺(tái)的導(dǎo)入功能。
13.支持會(huì)員注冊(cè)登錄,后臺(tái)管理功能。
WordPress優(yōu)化版全代碼合集
<!--添加優(yōu)化代碼到主題目錄functions.php文件-->
/*徹底關(guān)閉自動(dòng)更新(核心程序/主題/插件/翻譯自動(dòng)更新*/
add_filter('automatic_updater_disabled', '__return_true');
/*關(guān)閉更新檢查定時(shí)作業(yè)*/
remove_action('init', 'wp_schedule_update_checks');
/*移除已有的版本檢查定時(shí)作業(yè)*/
wp_clear_scheduled_hook('wp_version_check');
/*移除已有的插件更新定時(shí)作業(yè)*/
wp_clear_scheduled_hook('wp_update_plugins');
/*移除已有的主題更新定時(shí)作業(yè)*/
wp_clear_scheduled_hook('wp_update_themes');
/*移除已有的自動(dòng)更新定時(shí)作業(yè)*/
wp_clear_scheduled_hook('wp_maybe_auto_update');
/*移除后臺(tái)內(nèi)核更新檢查*/
remove_action( 'admin_init', '_maybe_update_core' );
/*移除后臺(tái)插件更新檢查*/
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
/*移除后臺(tái)主題更新檢查*/
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );
/*關(guān)閉程序更新提示*/
add_filter( 'pre_site_transient_update_core', function($a){ return null; });
/*關(guān)閉插件更新提示*/
add_filter('pre_site_transient_update_plugins', function($a){return null;});
/*關(guān)閉主題更新提示*/
add_filter('pre_site_transient_update_themes', function($a){return null;});
//關(guān)閉WordPress的XML-RPC功能
add_filter('xmlrpc_enabled', '__return_false');
/* 關(guān)閉XML-RPC的pingback端口 */
add_filter( 'xmlrpc_methods', 'remove_xmlrpc_pingback_ping' );
function remove_xmlrpc_pingback_ping( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
}
//禁用 pingbacks, enclosures, trackbacks
remove_action( 'do_pings', 'do_all_pings', 10 );
//去掉 _encloseme 和 do_ping 操作
remove_action( 'publish_post','_publish_post_hook',5 );
/* 禁止加載s.w.org獲取表情和頭像 */
remove_action('wp_head', 'print_emoji_detection_script', 7 );
remove_action('admin_print_scripts','print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
function remove_dns_prefetch( $hints, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
return array_diff( wp_dependencies_unique_hosts(), $hints );
}
return $hints;
}
add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );
/* 完全禁止REST API、移除wp-json鏈接 */
function lerm_disable_rest_api( $access ) {
return new WP_Error(
'Stop!',
'Soooooryyyy',
array(
'status' => 403,
)
);
}
add_filter( 'rest_authentication_errors', 'lerm_disable_rest_api' );
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
/* 禁止查詢網(wǎng)站靜態(tài)資源連接版本字符 */
function _remove_script_version ( $src ){
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
/* 移除前端網(wǎng)頁(yè)源代碼內(nèi)的頭部冗余代碼 */
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'wp_generator' );
/* 禁止新版文章編輯器加載前端樣式 */
function wpassist_remove_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
}
remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
add_action( 'wp_enqueue_scripts', 'wpassist_remove_block_library_css' );
/* 移除新版本站點(diǎn)健康狀態(tài)面板和菜單項(xiàng) */
add_action( 'admin_menu', 'remove_site_health_menu' );
function remove_site_health_menu(){
remove_submenu_page( 'tools.php','site-health.php' );
}
/* 禁用5.5版后自帶的XML站點(diǎn)地圖 */
add_filter( 'wp_sitemaps_enabled', '__return_false' );
/* 移除前后臺(tái)頂部工具欄指定菜單 */
function admin_bar_item ( WP_Admin_Bar $admin_bar ) {
$admin_bar->remove_menu('wp-logo'); //移動(dòng)wp的logo
$admin_bar->remove_menu('site-name'); //移動(dòng)站點(diǎn)名稱
$admin_bar->remove_menu('updates'); //移動(dòng)更新提示
$admin_bar->remove_menu('comments'); //移動(dòng)評(píng)論提示
/*$admin_bar->remove_menu('new-content'); //移除新建按鈕 */
}
add_action( 'admin_bar_menu', 'admin_bar_item', 500 );
//移除后臺(tái)儀表盤站點(diǎn)健康狀態(tài)面板
add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
function remove_site_health_dashboard_widget()
{
remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
}
//移除后臺(tái)儀表盤菜單:站點(diǎn)健康狀態(tài)
add_action( 'admin_menu', 'remove_site_health_menu' );
function remove_site_health_menu(){
remove_submenu_page( 'tools.php','site-health.php' );
}
//移除后臺(tái)儀表盤菜單:活動(dòng)、新聞
function bzg_remove_dashboard_widgets() {
global $wp_meta_boxes;
#移除 "活動(dòng)"
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
#移除 "WordPress 新聞"
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
}
add_action('wp_dashboard_setup', 'bzg_remove_dashboard_widgets' );
//移除后臺(tái)儀表盤菜單:幫助
function bzg_remove_help() {
get_current_screen()->remove_help_tabs();
}
add_action('admin_head', 'bzg_remove_help');
//移除后臺(tái)頁(yè)面title標(biāo)題的wordpress后綴
add_filter('admin_title', 'delAdminTitle', 10, 2);
function delAdminTitle($admin_title, $title){
return $title.' ‹ '.get_bloginfo('name');
}
//移除登陸頁(yè)面title標(biāo)題的wordpress后綴
add_filter('login_title', 'remove_login_title', 10, 2);
function remove_login_title($login_title, $title){
return $title.' ‹ '.get_bloginfo('name');
}
/* 徹底禁止4.4+版之后響應(yīng)式圖片功能及縮略圖裁剪功能*/
// 禁止生成圖像尺寸
function zm_customize_image_sizes( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'medium_large' ] );
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
unset( $sizes['1536x1536'] );
unset( $sizes['2048x2048'] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'zm_customize_image_sizes' );
// 禁止縮放圖片尺寸
add_filter('big_image_size_threshold', '__return_false');
// 禁止生成其它圖像尺寸
function shapeSpace_disable_other_image_sizes() {
// 禁止通過(guò)set_post_thumbnail_size()函數(shù)生成的圖片尺寸
remove_image_size('post-thumbnail');
// 禁止添加其它圖像尺寸
remove_image_size('another-size');
}
add_action('init', 'shapeSpace_disable_other_image_sizes');
//切換經(jīng)典文章編輯器(v5.x開始默認(rèn)古騰堡編輯器)
add_filter('use_block_editor_for_post', '__return_false');
//替換評(píng)論用戶頭像鏈接為國(guó)內(nèi)鏡像加速訪問(wèn)
add_filter('get_avatar', function ($avatar) {
return str_replace([
'www.gravatar.com/avatar/',
'0.gravatar.com/avatar/',
'1.gravatar.com/avatar/',
'2.gravatar.com/avatar/',
'secure.gravatar.com/avatar/',
'cn.gravatar.com/avatar/'
], 'cravatar.cn/', $avatar);
});
//取消內(nèi)容轉(zhuǎn)義
remove_filter('the_content', 'wptexturize');
//取消摘要轉(zhuǎn)義
remove_filter('the_excerpt', 'wptexturize');
//取消評(píng)論轉(zhuǎn)義
remove_filter('comment_text', 'wptexturize');
//禁止轉(zhuǎn)義引號(hào)字符
remove_filter('the_content', 'wptexturize'); // 禁止英文引號(hào)轉(zhuǎn)義為中文引號(hào)
//文章插入圖片自動(dòng)移除 img 的 width、height、class 屬性;
add_filter( 'post_thumbnail_html', 'fanly_remove_images_attribute', 10 );
add_filter( 'image_send_to_editor', 'fanly_remove_images_attribute', 10 );
function fanly_remove_images_attribute( $html ) {
//$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
$html = preg_replace( '/width="(\d*)"\s+height="(\d*)"\s+class="[^"]*"/', "", $html );
$html = preg_replace( '/ /', "", $html );
return $html;
}
// 自適應(yīng)圖片刪除width和height
function ludou_remove_width_height_attribute($content){
preg_match_all('/<[img|IMG].*?src=[\'|"](.*?(?:[\.gif|\.jpg|\.png\.webp]))[\'|"].*?[\/]?>/', $content, $images);
if(!empty($images)) {
foreach($images[0] as $index => $value){
$new_img = preg_replace('/(width|height)="\d*"\s/', "", $images[0][$index]);
$content = str_replace($images[0][$index], $new_img, $content);
}
}
return $content;
}
//判斷是否是移動(dòng)設(shè)備瀏覽
if(wp_is_mobile()) {
#刪除文章內(nèi)容中img的width和height屬性
add_filter('the_content', 'ludou_remove_width_height_attribute', 99);
}
/* 刪除文章時(shí)刪除圖片附件 */
function delete_post_and_attachments($post_ID) {
global $wpdb;
#刪除特色圖片
$thumbnails = $wpdb->get_results( "SELECT * FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND post_id = $post_ID" );
foreach ( $thumbnails as $thumbnail ) {
wp_delete_attachment( $thumbnail->meta_value, true );
}
#刪除圖片附件
$attachments = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_parent = $post_ID AND post_type = 'attachment'" );
foreach ( $attachments as $attachment ) {
wp_delete_attachment( $attachment->ID, true );
}
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND post_id = $post_ID" );
}
add_action('before_delete_post', 'delete_post_and_attachments');
WordPress優(yōu)化版建站步驟
1、下載最新版的Wordpress安裝包(cPanel中有一鍵安裝Wordpress程序的功能)
2、將Wordpress安裝包上傳至網(wǎng)站根目錄(可以在主機(jī)管理面板中操作),進(jìn)行解壓,將wp-config-sample.php文件,重命名為wp-config.php
3、接下來(lái),打開瀏覽器輸入域名,會(huì)出現(xiàn)一個(gè)WordPress安裝指南,點(diǎn)擊“現(xiàn)在就開始”
4、填寫上面創(chuàng)建的數(shù)據(jù)庫(kù)信息
注:也可以直接在wp-config.php中填入數(shù)據(jù)庫(kù)信息。
5、點(diǎn)擊“提交”,如果提示成功連接數(shù)據(jù)庫(kù),點(diǎn)擊“現(xiàn)在安裝”即可,如果提示失敗,需要會(huì)控制面板查看數(shù)據(jù)庫(kù)信息。
6、接下來(lái),輸入網(wǎng)站基本信息,保存好網(wǎng)站用戶名和密碼,點(diǎn)擊“安裝WordPress”即可。
7、在點(diǎn)擊“登錄”,輸入剛剛保存的用戶名和密碼,即可進(jìn)入WordPress后臺(tái)
8、進(jìn)入WordPress后臺(tái),選擇菜單中的“外觀-主題”,上傳前面選擇的WordPress主題。
9、點(diǎn)擊“啟用”主題即可,完成搭建WordPress網(wǎng)站。
10、接下來(lái),就可以安裝自己的心意設(shè)置網(wǎng)站,投放網(wǎng)站內(nèi)容等等操作了。
WordPress優(yōu)化版怎么看別人的文章
1,首先在網(wǎng)頁(yè)中點(diǎn)擊鼠標(biāo)右鍵查看源代碼。
2,然后在源代碼頁(yè)面上面按ctrl+f查找wp-content/themes/
會(huì)看到wp-content/themes/后面的就是主題的名稱。
post_author:(整數(shù))文章作者的編號(hào)
post_data:(字符)文章發(fā)表的日期和時(shí)間(YYYY-MM-DD HH-MM-SS)
post_data_gmt:(字符)文章發(fā)表的格林尼治標(biāo)準(zhǔn)時(shí)間(GMT) (YYYY-MM-DD HH-MM-SS)
post_content:(字符)文章內(nèi)容
post_title:(字符)文章標(biāo)題
post_category:(整數(shù))文章類別的編號(hào)。注意:該值在WordPress 2.1之后的版本總為0。定義文章的類別時(shí)可使用 get_the_category()函數(shù)。
post_excerpt:(字符)文章摘要
post_status:(字符)文章狀態(tài)(publish|pending|draft|private|static|object|attachment|inherit|future)
comment_status:(字符)評(píng)論狀態(tài)(open|closed|registered_only)
ping_status:(字符)pingback/trackback狀態(tài)(open|closed)
post_password:(字符)文章密碼
post_name:(字符)文章的URL嵌套
to_ping:(字符)要引用的URL鏈接
pinged:(字符)引用過(guò)的鏈接
post_modified:(字符)文章最后修改時(shí)間(YYYY-MM-DD HH-MM-SS)
post_modified_gmt:(字符)文章最后修改GMT時(shí)間(YYYY-MM-DD HH-MM-SS)
post_parent:(整數(shù))父級(jí)文章編號(hào)(供附件等)
guid:(字符)文章的一個(gè)鏈接。注意:不能將GUID作為永久鏈接(雖然在2.5之前的版本中它的確被當(dāng)作永久鏈接),也不能將它作為文章的可用鏈接。GUID是一種獨(dú)有的標(biāo)識(shí)符,只是目前恰巧成為文章的一個(gè)鏈接。
post_type:(字符)(日志 | 頁(yè)面 | 附件)
post_mime_type:(字符)Mime類型(供附件等)
comment_count:(整數(shù))評(píng)論總數(shù)
- 精選留言 來(lái)自吉林長(zhǎng)春聯(lián)通用戶 發(fā)表于: 2023-1-14
- 不錯(cuò),頂一下
- 精選留言 來(lái)自浙江湖州電信用戶 發(fā)表于: 2023-5-8
- 很好用的,很其他人口中介紹的一樣
- 精選留言 來(lái)自黑龍江牡丹江移動(dòng)用戶 發(fā)表于: 2023-4-15
- 支持一下!會(huì)分享給同學(xué)嘗試一下
- 精選留言 來(lái)自吉林吉林電信用戶 發(fā)表于: 2023-2-6
- 正好需要,很難找的資源。
- 精選留言 來(lái)自福建廈門電信用戶 發(fā)表于: 2023-3-18
- 剛剛下載了這款軟件,有人告訴怎么使用嗎