Tag Archives: wordpress

WordPress website map sitemap.xml error repair

WordPress website map sitemap.xml error repair

Error overview

In building a website using WordPress, use the XML Sitemaps plug-in to create a sitemap.xml site map, but after creation, open sitemap.xml and report the following error

Solution

1. Find the wp-blog-header.php file in the root directory of the website and open it. Modify it as follows

<?php
if ( ! isset( $wp_did_header ) ) {
	$wp_did_header = true;ob_start();
	// Load the WordPress library.
	require_once __DIR__ . '/wp-load.php';
	// Set up the WordPress query.
	wp(); ob_end_clean();
	// Load the theme template.
	require_once ABSPATH . WPINC . '/template-loader.php';
}

2. Refresh sitemap.xml to find that it can be used

404 solution for WordPress Chinese tag

One of the common problems in blogs or websites built by WordPress is that the Chinese tag link does not exist. Google Administrator Tool prompt grabs 404 errors. In particular, windows hosts often have Chinese tag link grabbing errors, and Chinese tags cannot be displayed normally. Or Chinese tags can be displayed normally, but 404 errors will appear after clicking the link, which brings great inconvenience to users and is extremely difficult It greatly reduces the friendliness of the website.

How to solve this problem?

First method:

Open WP include/ classes.php (before 3.1) or WP include/class- wp.php (after 3.1 +, hereinafter referred to as the new version) find line 154 (the new version is line 142)

$pathinfo = $_ SERVER['PATH_ INFO';

Replace with:

$pathinfo = mb_ convert_ encoding($_ SERVER['PATH_ INFO'], 'UTF-8', 'GBK');

Find line 159 (the new version is line 147)

$req_ uri = $_ SERVER['REQUEST_ URI'];

Replace with:

$req_ uri = mb_ convert_ encoding($_ SERVER['REQUEST_ URI'], 'UTF-8', 'GBK');

After my personal test, this method can be used, the new version of the statement may be different from the above, but the method is basically the same, the corresponding statement can be replaced.

Second method:

1. Found in the WP includes folder at the root of the site“ rewrite.php ”This document;

2. Back it up“ rewrite.php ”In case of error (we’d better back up the original code before changing the code);

3. Open“ rewrite.php ”We find the following code in the file:

function get_tag_permastruct()
{
   if (isset($this-&gt;tag_structure)) 
  {
    return $this-&gt;tag_structure;
  }
  if (empty($this-&gt;permalink_structure)) 
  { 
    //Change this line
    $this-&gt;tag_structure = '';
    return false;
  }
  if (empty($this-&gt;tag_base))
  $this-&gt;tag_structure = $this-&gt;front . 'tag/';
  else$this-&gt;tag_structure = $this-&gt;tag_base . '/';
  $this-&gt;tag_structure .= '%tag%';
  return $this-&gt;tag_structure;
}

4. Put some of them together

" if (empty($this-&gt;permalink_structure)) { ”

Amend to read

“ if (! empty($this-&gt;permalink_structure)) { ";

Note that there is only a “!” sign in English. After testing, this method is very effective. PS. didn’t find the code in this file directly…

The third method: the final solution to the Chinese tag 404 error is actually ISAPI_ Rewrite pseudo static rules are not well written, which leads to the failure to find the web page file. In fact, just change the rules: the previous tag pseudo static rules

RewriteRule /tag/(.*)$ /index\.php\?tag=$1

Changed rules

RewriteRule /tag/(.*)/$ /index\.php\?tag=$1

I didn’t test this method, so I can’t guarantee its availability. Please back it up before modification!

Third method:

If the above two methods are not feasible, we recommend another method: alias each tag.

Alias is another URL friendly name. It is usually lowercase and can only contain letters, numbers and hyphens.

But for blogs with more than 100 Chinese tags, this method has a huge workload. Use with caution.

This method can link English tags normally, but it works for websites with Chinese tag problems, but it doesn’t work for websites with 404 English tag links.

About WLW (Windows Live Writer): “unable to connect to your log service: invalid server response” solution

The following error occurred while configuring the blog’s WLW (Windows Live Writer) service: “unable to connect to your log service: invalid server response – received response from the log server blogger.getUsersBlogs Method’s response is invalid: invalid response document returned from XMLRPC server. Please try to resolve the problem and try again. ”

Document the solution:

Windows Live Writer (hereinafter referred to as WLW) is a very convenient blog offline editor launched by Microsoft. Recently, I want to use it to update the blog, but there are many problems in the configuration. Please record here for more friends to see.

First of all, to use WLW in WordPress, you must enable the XML-RPC publishing protocol. This protocol is enabled by default in WordPress versions after 3.5. If it is a version before 3.5, you need to find the xml-prc protocol under the “Settings – & gt; composition” menu, and then open it.

After the service is started, configure the parameters according to the regulations and wait for the link. The result is “unable to connect to your log service: invalid response from the server – the response received from the log server is invalid” blogger.getUsersBlogs Method’s response is invalid: invalid response document returned from XMLRPC server. Please try to resolve the problem and try again. ” This is a mistake.

The cause of this problem is very simple – this is due to a bug in WordPress itself. Under UTF-8 encoding, XML RPC returns an incorrect format and lacks three bytes.

Find the reason and solve it

    Step 1: find class- IXR.php The second step is to open and edit the class- IXR.php File, and then find the statement [$length = strlen ($XML);] to replace [$length = strlen ($XML) + 3;], and the problem is solved!

Note: please back up the original file before editing

OK, restart WLW to link. Is that ok?

OK, the problem was solved successfully~~

Sudo: unable to resolve host solution

When using the sudo command of Linux, some people may encounter such a problem: “sudo: can’t parse the host: xxxxx (your host name). I also encounter this problem. I have found a solution on the Internet and share it with you here.

This problem is caused by the hosts file is not well configured, Linux can not resolve to your host address, the solution is as follows:

sudo vim /etc/hosts

VIM is the command of your text editor. If you don’t have VIM in your computer, you can use GEDIT.

After opening the file, the

127.0.1.1  xxxxx

The following XXX is replaced by your computer host name, which is the last string of characters in the error. If not, add it in. If there are many parts of soybean oil, they can be replaced in batches.

Article link: sudo: unable to resolve host solution

Causes and solutions of WordPress media library pictures not showing or showing errors

Recently, I am developing a WordPress Theme – wait theme, but in the process of development, a wonderful problem suddenly appears, the media library pictures are not displayed!! Always show the small circle in loading, and upload images always fail. After struggling for two or three days, I finally found out the problem and quickly wrote it down….

describe

Recently, I am developing a WordPress Theme – wait theme, but in the process of development, a wonderful problem suddenly appears, the media library pictures are not displayed!! Always show the small circle in loading, and upload images always fail. The details are shown in the figure below:

The selection list mode is normal

attempt

After finding this problem, the other work of theme development can only be temporarily stopped and focused on solving this problem.

First go to the Internet search, the results found that the results are the same, what folder permissions, file coding problems, plug-in settings and so on.

However, this is a local test system. No plug-ins are installed and there is no permission problem. The coding format is utf8 without BOM.

It is found that a few netizens have the same problem as me, but no one below gives a solution…..

After the search on the Internet is fruitless, we can only find a solution by ourselves.

explore

First of all, I suspect that my topic function has the same name as the function of WP. So open it upload.php , compare the functions one by one with the functions written by yourself, and find that there is no duplicate name problem, so this option is excluded.

Then check the admin file, no suspicious situation is found.

In the browser debugging window, check the loading and debugging of CSS and JS, and no exception is found.

Finally, there is no way to open the code window, line by line to view the code, also did not find anything suspicious.

It took me two or three days to go back and forth in this way. Until this afternoon, I found the root of the problem~~~~

problem

When looking at the code again this afternoon, I suddenly found such a statement:

The problem lies in this sentence!!!!

Look at the explanation of HTML Declaration on w3school

≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag.

≪! DOCTYPE & gt; declaration is not an HTML tag; it is an instruction to the web browser about which HTML version the page is written with.

In HTML 4.01, the & lt;! DOCTYPE & gt; declaration references DTD because HTML 4.01 is based on SGML. DTD specifies the rules of markup language, so that the browser can present the content correctly.

HTML5 is not based on SGML, so there is no need to reference DTD.

Tip: always add a & lt;! DOCTYPE & gt; declaration to an HTML document so that the browser knows the document type.

≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag! ≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag! ≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag!

Three important words~~

Therefore, as long as the above obnoxious sentence is removed, this problem can be solved ~ ~
by removing it

solve

Looking for the source code, I found that there was a reference in my admin file:

At that time, I thought that this sentence would be in the main body of the web page, so I wrote it. But today, I found that no matter where I put it, it will always appear in the first line of the web page!!! WTF!!!

Only by deleting it and writing the CSS code to the file, can the problem be solved successfully~~~~

summary

1. Don’t blindly believe in things on the Internet, do it yourself is the king

2. Debugging a bug starts with the source code.

3. When it comes to problems, be calm and don’t be impatient~~

4. Do it yourself~~~

prospect

Wait theme will be released soon, please look forward to it~~~

Reprint English blogs with source

Reprint English blogs with source

Reprint English blogs with source

Three important words~~


Welcome to my website:

Other English Blogs

++>

Causes and solutions of WordPress media library pictures not showing or showing errors

Solution of U disk content hidden by virus

Recently, I found that I have a virus in my USB flash disk, and the contents of the USB flash disk are hidden. However, when I view the properties, all of them actually occupy the memory. The effect is as shown in the figure. I believe many friends have encountered this kind of problem, so how to solve it?


The figure is as follows:

First of all, check whether the contents of the U disk are cleared or hidden. If it is cleared by a virus, you can only use the recovery tool to recover. But if it’s just hidden, you can use the “tools” button in the menu bar -& gt ; Folder selection -& gt ; see -& gt ; Show hidden folders to show hidden files.

If all the hidden files exist, you can use the following method to remove them.

1. Create a new TXT in the USB flash disk with any name;

2. Enter:

attrib -s -h /s /d

3. Change the suffix to. Bat, and then double-click to run.

You can also pay attention to my personal blog

Other English Blogs

The solution of U disk content hidden by virus

Restoring web applications from an installatron backup on my Linux host

If by the United States Center for Domain name US Domain Center: http://www.usdomaincenter.com/ Installatron installed in the Linux host account application, you can use Installatron backup these applications. You can then use these backups to restore your application to its previous state.
Required: Installatron does not automatically create a backup file for your application – you must have created the backup file manually and then follow these steps.

    Go to the US Domain Center product page. Under Web Hosting, select Manage next to the Linux Hosting account you want to use. In the Accounts Dashboard (control panel), select CPanel Admin (CPanel Administrator). On the cPanel home page, select Web Applications, and then under My Applications, select the Web application that you want to restore (for example, WordPress in the screenshot below). On the installed page, in the top right corner, click My Backup. Next to the backup you want to use, click the icon below Restore to the original location, and click Continue. Click Restore.

Wamp install WordPress prompt can’t select database

1. Make sure all of the following are correct when installing.

    /** The name of the database for WordPress */
    define( 'DB_NAME', 'database_name_here' );
    
    /** MySQL database username */
    define( 'DB_USER', 'username_here' );
    
    /** MySQL database password */
    define( 'DB_PASSWORD', 'password_here' );
    
    /** MySQL hostname */
    define( 'DB_HOST', 'localhost' );
    
    /** Database Charset to use in creating database tables. */
    define( 'DB_CHARSET', 'utf8' );
    
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'DB_COLLATE', '' );


, then maybe you my hand is out of control switched the database to Mariadb, because wamp USES Mysql by default. Even though you have set up a corresponding database in Mariadb and have authorized it, it still doesn’t work.


switch back, right click, as shown in the picture below:

wordpress :This block has encountered an error and cannot be previewed

Version update background edit when previously added block is not editable
This block has encountered an error and cannot be previewed
Check the error message React -dom.min.js?Ver =16.9.0:103 TypeError: m.find is not a function
Because I’m using the Stargazer template
Modify the template file functions.php
Add to it
add_action( ‘after_setup_theme’, function() { remove_theme_support( ‘editor-color-palette’ ); });

WordPress appears Too many failed login attempts error solution

Use idle resources to earn pocket money (suitable for school students and housewives)
Solutions:
1. Log in to the database
mysql -uroot -p
Enter the password
2. Select your database instance (e.g., my instance name is Blog)
use blog;
3. Execute the following command (the table name depends on what the prefix is and find the table with the _options suffix).
Update TB_options Set option_value= ‘where option_name=’ WAS_LIMIT_login_lockouts’;

use the idle resources of computer to earn pocket money (suitable for students and housewives)
online generating external chain tools (international version)
online generating external chain tools (Chinese version)

WordPress cannot install themes and plugins online: wp_remote_post failed:

                                  使用WordPress出现无法在线安装主题和插件

USES domestic servers of ali cloud, while some wordpress resources need to use Google resources. Currently, Google cannot be accessed normally in China, which leads to the error.
solution:
directly in the pagoda PHP management, by setting the timeout limit, default 100 seconds to 600 seconds, restart PHP.

WordPress download template, update error No working transports found solution

    error because PHP did not open curl. Windows open method as follows

    1. Put php.ini; 2. Extension = remove the semicolon in front of php_curl. DLL
    Libeay32.ll, ssleay32.dll, php_curl, libssh2.dll move PHP into Windows /system32, and then restart Apache server, problem solved note: many answers on the net are put libeay32.ll, ssleay32.dll, php_curl. DLL three files are enough, but I try to come down, but also need libssh2.dll