軟件介紹
WordPress優化版是一款專為每一個博主和網站建設者帶來一個全新的網站的建設,這里有著豐富的建設方式,全新的素材內容讓你的網站快速完成建設,帶給你最簡單的創建方式。WordPress電腦版適用于各個精彩行業,網站建設、博客論壇、營銷網頁等等,用戶在這里根據自己的喜好去創建,沒有任何的復雜程度,輕松構建。
WordPress讓你在這里完成全新的創建方式,精彩的圖文排版,無需任何的專業代碼,也不需要手冊,小白也能根據步驟一步一步完成創建,不受你的約束。
WordPress優化版特色
1.文章發布、分類、歸檔、收藏,統計閱讀次數。
2.提供文章、評論、分類等多種形式的聚合。
3.提供鏈接的添加、歸類功能。
4.支持評論的管理,垃圾信息過濾功能。
5.支持多樣式CSS和PHP程序的直接編輯、修改。
6.在Blog系統外,方便的添加所需頁面。
7.通過對各種參數進行設置,使Blog更具個性化。
8.在某些插件的支持下實現靜態html頁面生成(如WP-SUPER-CACHE)。
9.通過選擇不同主題,方便地改變頁面的顯示效果。
10.通過添加插件,可提供多種特殊的功能。
11.支持Trackback和pingback。
12.支持針對某些其它blog軟件、平臺的導入功能。
13.支持會員注冊登錄,后臺管理功能。
WordPress優化版全代碼合集
<!--添加優化代碼到主題目錄functions.php文件-->
/*徹底關閉自動更新(核心程序/主題/插件/翻譯自動更新*/
add_filter('automatic_updater_disabled', '__return_true');
/*關閉更新檢查定時作業*/
remove_action('init', 'wp_schedule_update_checks');
/*移除已有的版本檢查定時作業*/
wp_clear_scheduled_hook('wp_version_check');
/*移除已有的插件更新定時作業*/
wp_clear_scheduled_hook('wp_update_plugins');
/*移除已有的主題更新定時作業*/
wp_clear_scheduled_hook('wp_update_themes');
/*移除已有的自動更新定時作業*/
wp_clear_scheduled_hook('wp_maybe_auto_update');
/*移除后臺內核更新檢查*/
remove_action( 'admin_init', '_maybe_update_core' );
/*移除后臺插件更新檢查*/
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' );
/*移除后臺主題更新檢查*/
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' );
/*關閉程序更新提示*/
add_filter( 'pre_site_transient_update_core', function($a){ return null; });
/*關閉插件更新提示*/
add_filter('pre_site_transient_update_plugins', function($a){return null;});
/*關閉主題更新提示*/
add_filter('pre_site_transient_update_themes', function($a){return null;});
//關閉WordPress的XML-RPC功能
add_filter('xmlrpc_enabled', '__return_false');
/* 關閉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 );
/* 禁止查詢網站靜態資源連接版本字符 */
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 );
/* 移除前端網頁源代碼內的頭部冗余代碼 */
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' );
/* 移除新版本站點健康狀態面板和菜單項 */
add_action( 'admin_menu', 'remove_site_health_menu' );
function remove_site_health_menu(){
remove_submenu_page( 'tools.php','site-health.php' );
}
/* 禁用5.5版后自帶的XML站點地圖 */
add_filter( 'wp_sitemaps_enabled', '__return_false' );
/* 移除前后臺頂部工具欄指定菜單 */
function admin_bar_item ( WP_Admin_Bar $admin_bar ) {
$admin_bar->remove_menu('wp-logo'); //移動wp的logo
$admin_bar->remove_menu('site-name'); //移動站點名稱
$admin_bar->remove_menu('updates'); //移動更新提示
$admin_bar->remove_menu('comments'); //移動評論提示
/*$admin_bar->remove_menu('new-content'); //移除新建按鈕 */
}
add_action( 'admin_bar_menu', 'admin_bar_item', 500 );
//移除后臺儀表盤站點健康狀態面板
add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
function remove_site_health_dashboard_widget()
{
remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
}
//移除后臺儀表盤菜單:站點健康狀態
add_action( 'admin_menu', 'remove_site_health_menu' );
function remove_site_health_menu(){
remove_submenu_page( 'tools.php','site-health.php' );
}
//移除后臺儀表盤菜單:活動、新聞
function bzg_remove_dashboard_widgets() {
global $wp_meta_boxes;
#移除 "活動"
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' );
//移除后臺儀表盤菜單:幫助
function bzg_remove_help() {
get_current_screen()->remove_help_tabs();
}
add_action('admin_head', 'bzg_remove_help');
//移除后臺頁面title標題的wordpress后綴
add_filter('admin_title', 'delAdminTitle', 10, 2);
function delAdminTitle($admin_title, $title){
return $title.' ‹ '.get_bloginfo('name');
}
//移除登陸頁面title標題的wordpress后綴
add_filter('login_title', 'remove_login_title', 10, 2);
function remove_login_title($login_title, $title){
return $title.' ‹ '.get_bloginfo('name');
}
/* 徹底禁止4.4+版之后響應式圖片功能及縮略圖裁剪功能*/
// 禁止生成圖像尺寸
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() {
// 禁止通過set_post_thumbnail_size()函數生成的圖片尺寸
remove_image_size('post-thumbnail');
// 禁止添加其它圖像尺寸
remove_image_size('another-size');
}
add_action('init', 'shapeSpace_disable_other_image_sizes');
//切換經典文章編輯器(v5.x開始默認古騰堡編輯器)
add_filter('use_block_editor_for_post', '__return_false');
//替換評論用戶頭像鏈接為國內鏡像加速訪問
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);
});
//取消內容轉義
remove_filter('the_content', 'wptexturize');
//取消摘要轉義
remove_filter('the_excerpt', 'wptexturize');
//取消評論轉義
remove_filter('comment_text', 'wptexturize');
//禁止轉義引號字符
remove_filter('the_content', 'wptexturize'); // 禁止英文引號轉義為中文引號
//文章插入圖片自動移除 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;
}
// 自適應圖片刪除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;
}
//判斷是否是移動設備瀏覽
if(wp_is_mobile()) {
#刪除文章內容中img的width和height屬性
add_filter('the_content', 'ludou_remove_width_height_attribute', 99);
}
/* 刪除文章時刪除圖片附件 */
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優化版建站步驟
1、下載最新版的Wordpress安裝包(cPanel中有一鍵安裝Wordpress程序的功能)
2、將Wordpress安裝包上傳至網站根目錄(可以在主機管理面板中操作),進行解壓,將wp-config-sample.php文件,重命名為wp-config.php
3、接下來,打開瀏覽器輸入域名,會出現一個WordPress安裝指南,點擊“現在就開始”
4、填寫上面創建的數據庫信息
注:也可以直接在wp-config.php中填入數據庫信息。
5、點擊“提交”,如果提示成功連接數據庫,點擊“現在安裝”即可,如果提示失敗,需要會控制面板查看數據庫信息。
6、接下來,輸入網站基本信息,保存好網站用戶名和密碼,點擊“安裝WordPress”即可。
7、在點擊“登錄”,輸入剛剛保存的用戶名和密碼,即可進入WordPress后臺
8、進入WordPress后臺,選擇菜單中的“外觀-主題”,上傳前面選擇的WordPress主題。
9、點擊“啟用”主題即可,完成搭建WordPress網站。
10、接下來,就可以安裝自己的心意設置網站,投放網站內容等等操作了。
WordPress優化版怎么看別人的文章
1,首先在網頁中點擊鼠標右鍵查看源代碼。
2,然后在源代碼頁面上面按ctrl+f查找wp-content/themes/
會看到wp-content/themes/后面的就是主題的名稱。
post_author:(整數)文章作者的編號
post_data:(字符)文章發表的日期和時間(YYYY-MM-DD HH-MM-SS)
post_data_gmt:(字符)文章發表的格林尼治標準時間(GMT) (YYYY-MM-DD HH-MM-SS)
post_content:(字符)文章內容
post_title:(字符)文章標題
post_category:(整數)文章類別的編號。注意:該值在WordPress 2.1之后的版本總為0。定義文章的類別時可使用 get_the_category()函數。
post_excerpt:(字符)文章摘要
post_status:(字符)文章狀態(publish|pending|draft|private|static|object|attachment|inherit|future)
comment_status:(字符)評論狀態(open|closed|registered_only)
ping_status:(字符)pingback/trackback狀態(open|closed)
post_password:(字符)文章密碼
post_name:(字符)文章的URL嵌套
to_ping:(字符)要引用的URL鏈接
pinged:(字符)引用過的鏈接
post_modified:(字符)文章最后修改時間(YYYY-MM-DD HH-MM-SS)
post_modified_gmt:(字符)文章最后修改GMT時間(YYYY-MM-DD HH-MM-SS)
post_parent:(整數)父級文章編號(供附件等)
guid:(字符)文章的一個鏈接。注意:不能將GUID作為永久鏈接(雖然在2.5之前的版本中它的確被當作永久鏈接),也不能將它作為文章的可用鏈接。GUID是一種獨有的標識符,只是目前恰巧成為文章的一個鏈接。
post_type:(字符)(日志 | 頁面 | 附件)
post_mime_type:(字符)Mime類型(供附件等)
comment_count:(整數)評論總數
- 精選留言 來自甘肅天水電信用戶 發表于: 2023-9-11
- 支持一波~~6666666666
- 精選留言 來自陜西商洛電信用戶 發表于: 2023-6-23
- 介紹的很詳細
- 精選留言 來自甘肅蘭州電信用戶 發表于: 2023-2-8
- 這個軟件真好用,就會一直支持下去的
- 精選留言 來自廣東云浮聯通用戶 發表于: 2023-4-18
- are you 不錯~
- 精選留言 來自黑龍江七臺河移動用戶 發表于: 2023-3-17
- 挺好的,目前沒發現有什么問題,五星好評