Regular expressions (abbreviated regex) are terms that define a search pattern to focus on a specific part of a string for a specific purpose (e.g. to find/replace a word).

learn more… | top users | synonyms

0
votes
2answers
367 views

how to properly rewrite url by custom var

ive been trying to rewrite a shop uri, and what i have now is this code: add_filter('rewrite_rules_array','wp_insertMyRewriteRules'); add_filter('query_vars','wp_insertMyRewriteQueryVars'); ...
0
votes
1answer
808 views

get_shortcode_regex() only matches first shortcode

The Codex has an example of using get_shortcode_regex() to check if a shortcode is being called on a given page: $pattern = get_shortcode_regex(); preg_match('/'.$pattern.'/s', ...
-1
votes
2answers
1k views

How to strip/remove all blank spaces at the beginning/end of a search string

I use hack of Chris_O for highlighting the search terms. When a user enters the search keywords without any blank space in the beginning or at end of the search string it retrieves and highlights the ...
2
votes
1answer
288 views

Retrieving all Links from a Post?

i'm using the default "insert video" function from wordpress (which inserts a normal hyperlink to the video only) and would like to replace that link with something else like a video player. my ...
0
votes
2answers
275 views

Testing a Form's Zipcode Field with Regular Expressions to Determine Wordpress Page Behaviour

I want to use a Regular Expression(regex) to test the value of a form's zipcode field on a WordPress page, then based upon those results either: Selectively assign/reveal price fields on the same ...
1
vote
2answers
1k views

How to change the admin menu “Pages” to something else

When one creates a custom post type you have the ability to define various elements related to that post type which essentially allow you to define things such as the menu title, "add new post" text ...
1
vote
3answers
406 views

404 regular-expression advice needed

I have been working hard trying to understand regular-expressions to use in my web site using the redirection plugin. I have changed my permalinks a few times in the past year because I did not know ...
4
votes
3answers
1k views

Nested Shortcode Detection

If you are familiar with this code <?php $pattern = get_shortcode_regex(); preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches); if (is_array($matches) && $matches[2] ...
1
vote
2answers
813 views

How to apply content filter permanently?

I have the following temporary filter to fix a content error. We have data in our posts that have 4 digit zip codes, because the leading zero was cut when the original file was created. (For instance, ...