Page no: P35c
Table of contents
Definition: post stands for a post or a page
For our Stop Words plugin we have three procedures that need documentation.
- Restore old postname based on titles (and family name)
- Make postname unique procedure
- Remove stop words
Definition: Postname is the last part of the URL (see full explanation on the Yoast/Mark Cutts permalink article)
Avoid duplicate URL
We must check if the generated URL does not exist yet. This is done by default in WordPress, but our plugin does not do this. It might call the core WP procedure for this check.
Decision: WordPress does not use full URL, but only the postname to identify a post. For performance reasons we prefer to use the post ID instead of a postname numbering. The test if the post exists, is done only once. If the post name exists already then we add the post ID.
Advantage of this procedure: we do not need to count the number of posts with the same post name.
Avoid duplicate URL (pro and light version)
We must check if the generated URL does not exist yet. This is done by default in WordPress, but our plugin does not do this. It might call the core WP procedure for this check.
Decision: WordPress does not use full URL, but only the postname to identify a post. For performance reasons we prefer to use the post ID instead of a postname numbering. The test if the post exists, is done only once. If the post name exists already then we add the post ID.
Advantage of this procedure: we do not need to count the number of posts with the same post name.
Algorithm to remove the stop words
|
|
Main AlgorithmsRemove stop words
|
|
|||||||||||||||||||||
This is the algorithm that removes stop words. Input: A post or page with its postname Procedure:
Output: unique postname with stop words removed (for all posts/pages in the DB) |
||||||||||||||||||||||
Algo: Restore old postnameRestore Postname based on title (and family name) This is the algo for the button “Restore old URL based on titles”. Input: A post or page with its title and its URL
Procedure:
|
||||||||||||||||||||||
Algo: Make Postname uniqueThis is the algorithm to have unique Postnames and URLs. It is used by both restore old URLs and by the stop words algorithm.
Input: a post Procedure:
Output: a unique postname |
||||||||||||||||||||||
DifficultiesThere were some problems, which we had to deal with them 1) The category:??? All the tags and the categories are into one table wp_term.
Their relationships with the posts are in another and their type in another. This is this table: The problem was here that we had to find the fastest problem for checking the needed category. Why do we have to check the category for these algorithms?
Our plugin is time and resource consuming and we had to be careful with every new feature, because it can be over our limits. So we had to make only one query, which is fast and it will not cause problem when we run it more than 2800 times (depends on the posts). The second issue was that one post can have multiple categories. We had to use the main category (which is in the url). I thought that you do not have to care about the category inside the URL by the permalink mechanism.
This was problem, because we again had to think about speed. It was not good idea to make a new query only for that. So we implement this in the first function. Do these queries contain the category? No, they don’t. |
Table: wp_term_relationships
|
|||||||||||||||||||||
2) Two different quries for searching unique post
|
||||||||||||||||||||||
Acute Sign Stop Words
Acute Sign inside the https://snbchf.com/2017/06/activist-aims-staid-nestleacute/ Wrong problem
|
||||||||||||||||||||||
Explanation what happens:1) Input Title and URL 2) Then WordPress does; 3) then Stop Words, Output in URL, Title |
||||||||||||||||||||||
Sorry, I received wrong information about this post from the team. There is no any problem with è à î or other special symbols. The problem here was that Vasil was edited the title, but forgot to edit the URL. |
||||||||||||||||||||||
Keywords in Substrings |
Keywords in Substrings |
Tags: Plugin Stop Words Pro
See more for