If you give a look at the documentation, of str_replace
you will find your needs. https://www.php.net/manual/en/function.str-replace.php
There is 3 choices for you there :
function replace_text_wps($text){
$replace = array(
'https://www.facebook.com/something">' => 'https://www.instagram.com/something">',
);
$text = str_replace(array_keys($replace), array_values($replace), $text);
// OR
$text = str_replace(array(
'https://www.facebook.com/something">'
), array(
'https://www.instagram.com/something">'
), $text);
// OR
$text = str_replace('https://www.facebook.com/something">', 'https://www.instagram.com/something">', $text);
return $text;
}
add_filter('the_content', 'replace_text_wps',99, 1);
Related Posts:
- Why have on every line
- WordPress and event-driven programming – what is it about?
- What would be a PHP command to erase all posts from category X from the last month?
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- Display a selected custom product option in WooCommerce cart
- Custom post type column which compares dates?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Walker class: Problems with understanding how walk() method can be called without error
- Change comments form title on a page by page basis
- Limit the Excerpt field in WP-Admin in words
- How to create different menu’s for not logged in visitors and for logged in members?
- Custom Loop Pagination on WordPress
- delete an array element when its date expires
- Customized title tag for each page in pagination?
- How to break down importing of feeds
- Wrap First Character after in a tag
- How do I implement a .diff changeset from core.trac.wordpress.org locally?
- Multiple choice in a custom taxonomy
- Random Default Avatar Function
- Customizer: Output default value in Customizer CSS
- How to add just one specific page to widget without plugin?
- Taxonomy linked to pages
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Can I install/embed WordPress on a ‘single page’?
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- WordPress admin pointers tour bug?
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Custom posts in different columns style
- need help with existing code showing subpages
- How do I add a custom css to all posts without affecting homepage css? [closed]
- how to show only specific category for a template
- Advanced Custom Fields not displaying
- How to get private property in parent class into extended class?
- Exclude posts with specific metadata from search?
- Add data-id attribute to child page links
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Warning: Illegal string offset on theme options page [closed]
- Display Youtube Time Automate from Key
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- How to include custom PHP file both in header and footer files
- Check class_exists before class definition / Doxygen problem
- Extract links from content
- Delete or edit postmeta with specific meta_key?
- Integrating Yii2 and WordPress
- Custom Registration username_exists / email_exists
- After disabling WPML multi currency, the currency is still handled by the WPML
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- PHP Helper Class to create shortcodes
- Reusable code that I can store in the function.php and apply to other templates as need. Dry Code
- Is it possible to add a custom page to a free WordPress site? [closed]
- Is there a hack for using is_page() within the function.php file?
- How to Fix an Archive.php That Displays All Posts?
- Assign Custom classes to every Excerpt
- Make next post button link to random post
- How do I custom code the start page?
- Kohana Frontend, WordPress Backend
- Site DOES NOT LOAD after 3.1 update
- Customizer control save then return to default
- Create Columns with Custom Walker and CSS Classes
- WP-Bakery – Add custom colors to buttons with template colors
- update_user_meta as multiple value but with same meta key
- retrieve “Link Color” value
- Delete post meta by serialized meta value
- How to identify which php file a plugin is using on page load?
- Dynamic Banner Text based on Subdomain
- Create form which redirects to site in network?
- How to add a full working piece of website already coded, to a large scale Website design project?
- Redirecting the lost password page request when using a custon login page
- Remove specific javascript when viewing page in Customizer?
- Search only for posts with specific metadata?
- Running local copy of an old WordPress site on MAMP
- Customizing WooCommerce with PHP
- What image is this pulling?
- How can I customize a WordPress theme before it’s downloaded?
- Is there a way to have chunks of a page’s content expire?
- Where can I find the declaration of `$_wp_theme_features`?
- Static home page ignored
- How do I routinely extract the thumbnail of the most recent post?
- Showing the project type in HREF
- Display tab title as ‘blog tagline | blog title’
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- PHP call div with function
- Showing custom field contents without listing description
- How to use PHP code with wordpress page
- Check if values exists DB
- if is_bbPress register jquery
- Auto create description in post
- Pagination on Custom Loop
- error with WP custom form
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How can I clear the theme mod settings?
- MySQL Engine vs. Charset
- Custom PHP-coding in MU installs
- Date when the custom field was added
- Select area and checkbox data is not saving?
- In reading settings posts are set to “blog” and I have page-blog.php but no posts
- WP Custom tables query