【WordPress优化版】WordPress优化版下载 v5.9.0 中文正式版(整合全代码优化)

软件介绍

知识兔

WordPress优化版是一款专为每一个博主和网站建设者带来一个全新的网站的建设,这里有着丰富的建设方式,全新的素材内容让你的网站快速完成建设,带给你最简单的创建方式。WordPress电脑版适用于各个精彩行业,网站建设、博客论坛、营销网页等等,用户在这里根据自己的喜好去创建,没有任何的复杂程度,轻松构建。

WordPress优化版 第1张图片

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优化版全代码合集

知识兔

/*彻底关闭自动更新(核心程序/主题/插件/翻译自动更新*/

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['1536×1536'] );

unset( $sizes['2048×2048'] );

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:(整数)评论总数  

下载仅供下载体验和测试学习,不得商用和正当使用。

下载体验

请输入密码查看下载!

如何免费获取密码?

点击下载

标签

发表评论