function emailleftappend($content){
$content = preg_replace_callback('/(?<=get\/)(.*?)-(.*?)(?=\/">)/', function ($m) {
return sanitize_title($m[1]). '-'. sanitize_title($m[2]); }, $content);
return $content;
}
add_filter('the_content', 'emailleftappend');
the above fixed the issue for me. another way is below.
function emailleftappend($content){
$content = preg_replace_callback('/(?<=get\/)(.*?)-(.*?)(?=\/">)/', function ($m) {
return slug($m[1]). '-'. slug($m[2]); }, $content);
return $content;
}
add_filter('the_content', 'emailleftappend');
function slug($z){
$z = strtolower($z);
$z = preg_replace('/[^a-z0-9 -]+/', '', $z);
$z = str_replace(' ', '-', $z);
return trim($z, '-');
}
FINALLY FIXED
Related Posts:
- How to filter out shortcode when displaying the_excerpt() in the loop?
- WordPress: Highlight search result exact matches
- search and replace using regex
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Regex works in regexr, but not if I filter content [closed]
- How to add a data attribute to a WordPress menu item
- Order posts (across the whole site) by metadata date
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Relative URLs and hide /wp-content/themes/
- Disable visual editor on one specific page
- How to display random users with avatars
- Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?
- Slugs as breadcrumbs for Pages
- Different ‘WP_CONTENT_URL’ for different subsites in Multisite setup?
- Removing Unnecessary Text from Admin Menu without CSS
- Add a Post Thumbnail to an RSS Feed with custom size
- Display WordPress Search
- Remove_filter (‘the_content’, ‘wpautop’) is not working
- Preferred Use of home_url()?
- Where does function_exists() look to decide whether a function exists? [closed]
- Ajaxing function in widget class
- Clean-up script tags
- Make “sidebar template” the default template for new pages
- Refactor create_function
- WordPress function for 1 to for many
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Attach parent category template to all subcategories
- How can you limit srcset on a single type of page?
- Remove Font-Awesome MaxCDN Link & Load Locally
- How to remove howdy dropdown menu content
- How to fix Warning: call_user_func_array()?
- Stop turning small dashes into longer ones
- How to get specified parent page title in my function
- Execute function after a post has been published
- wp_register_script(… $in_footer = true) not working
- I want to get product attirbute in the section below
- Restore Image Title Text
- Output and filter data from a XML url
- Full page template function
- Redirect from “private” page and functions.php which tag add to add_action()?
- Display gallery on bottom after content
- watermarking gallery items
- WordPress listen to $_POST in functions.php
- WordPress Shortcode function display outside of widget
- Get rid of the widget Item Class=”widget-item”
- Add Element as a Filter to the_content
- Storing password (functions.php)
- WordPress function, Run using Crontab
- Check if the image size is available and if not use ‘full’ image size
- issue with if/elseif in_array inside foreach loop display only one post
- Change menu based on page template via functions.php
- Adding theme option values as custom body class
- Fail to get the total number of posts
- What is the correct way to include my new functions and scripts in WordPress?
- Call two different function.js depending on page
- Display a random tag but using cron to control frequency of change
- resizing of thumbnails not working
- How Do I include/Import a Custom Widget from the Parent theme into My Child Theme?
- Perform function on publish AND save (not just save)
- add_menu_page() with variable function
- include w_thumbnail_src in function?
- Need To Resize Images Exactly Without Losing Image Details
- How to add or delete default value theme options while activate and deactivate theme
- Custom blog post summary on blog index page
- the_date() and the_time() functions display actual date an time instead of published date and time
- Pass URL to iframe in WordPress Block
- How do I make the comment disappear after deleting from the database?
- Can’t load assets
- Ajax Form Issues using Lightsail (AWS)
- External api call and make global variable for any page visitor enters , page-home, page, single etc
- WP AJAX Request Not Working
- Unable to login after registration
- Remove the ‘category’ url for one category type
- CSS style and app.js not loading
- blank page with wp_get_attachment
- Parent category as WOOCommerce Categories widget title
- Altering page / category names in breadcumbs
- Change user role based on total number of items ordered
- Including admin-options.php file in Child Themes
- Rewrite rules and the permalink
- Adding an IF ELSE to a function
- wordpress ajax is not working for dropdown selection
- Providing fallback function and allow override by plugin
- How to prevent multiple custom terms from being created
- is_page_template wont allow me to enqueue scripts
- How to create a function to redirect a specified page to another page
- Updating site content after an AJAX call without a page reload
- need help with ‘… read more’ excerpt in functions.php
- How To Get WordPress Categories Last Update Date?
- unregister_sidebar in child theme not working
- Print all inline styles to head
- Function to return custom post type titles from blog id 1
- Use $_POST[‘value’] inside functions.php
- How to request login for user but not for bots
- Function Reference for custom link in Admin Menu Management Page
- Call ACF data from functions.php [closed]
- Load script only on selected Pages
- Using input_attrs() Multiple Times Within One Customizer Control
- Convert Image to Webp on upload without plugin