How to make search and replace in content through php
From the documentation of WP All Import, the pmxi_saved_post
action takes one parameter, $id
, which is “the ID of the post/page/Custom Post Type that was just created.”
So, your post_saved()
callback should look like this:
add_action('pmxi_saved_post', 'wpse246838_post_saved', 10, 1);
function wpse246838_post_saved( $id ) {
$my_post = array(
"ID" => $id,
"post_content" => "1",
);
wp_update_post( $my_post );
}
Related Posts:
- WordPress REST API – JSON “Rendered” Content Incorrect
- append_content help
- How to limit post content and remove image caption from it
- Change Content for Specific Page
- Replace full content with an excerpt
- How to have a “clean” post content, for excerpt and social networks sharing
- Is there a way to show only the text editor
- the_excerpt() in content.php and get_template_part() in single.php
- Divide post content in three columns
- preg_replace style attr in $content and Editing post_content before saving
- Retrieve content of page by URL Parameter
- The post content just showing up text
- Put teaser content, more-link and full content in different divs if existing… Possible?
- Scroll over to get definition [closed]
- Stop WordPress Wrapping Images In A “P” Tag
- Best practices for localizing WordPress content?
- if the post has content
- I want to have my custom field use HTML, how do I do that?
- Get content from one page and show it on another page
- Where to hook into post content?
- What’s the Best Way to Structure a Multi-Content Blog?
- How to Handle Distributed Development Workflow
- Insert Custom HTML After Shortcode
- Get Content From Blog Page
- Show content after the first and second paragraph
- Is it possible to handle a specific section of a post separately?
- What server settings are required to import WordPress XML file
- Is there a way to trigger an automatic import of a WP backup on creation of a new WP multisite site?
- Format content value from DB outside of WordPress filters
- Hiding posts and pages in panel
- Convert all youtube link to embed
- Testing for post title in ‘if/else’ statement returns no content
- wp_insert_post iframe missing
- Grabbing specific content
- What is the proper way to get contents of a page?
- $content = $post->post_content; with formating
- Does is_user_logged_in() block search bots?
- Finding the paragraphs in content
- Conflicting post edit options under dashboard
- Disable external (3rd party) CALL (images,fonts..) in Dashboard
- Get the content inside shortcode and apply external function to it?
- Can somebody tell me how I am supposed to be using blogs.dir for network / MU sites?
- How to make author box like this & add after every post?
- Extract an embedded video from the content
- Missing content in Pages only
- Doctype printed on the page content
- Remove Content Filter
- Main WordPress site with several flexible clones
- Add Attribute to p Tag of Post Content
- Post Format Default Content
- Post titles below the post format content
- Show image on the left and content on the right using ul li
- How To Watermark Audio
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Query does not return content
- tabbed content box with different tabbed background images
- Excerpt vs content formatting woes
- Split the_content into two parts
- Page content not visible in backend
- Body-only page for a 2-page form [closed]
- the_content() Not Grabbing All Content
- custom page with post content using read more
- Changing theme removes page content in dashboard’s post main editor
- Website showing random code like texts in a post after pasting from MS Word
- Simple Math Quiz or Captcha to hide whois query form
- Split the content of the_content();
- highlight specific text in the content box
- How do i configure my content to show full posts?
- How to show content for posts of a specific category only
- What is the best practice to localize content? (Geographic not langauge)
- Duplicate content with incremental titles. How is this happening?
- why my urdu text is not aligned properly when written in wordpress blog post?
- Upgrading to WP 5+ with block content – Export & Import Page Content
- Images over HTTPS endless issues – mixed content
- Remove pre and code tags from WordPress
- Printing first line of content in wordpress
- Custom slugs for Each Tab
- Using Elementor to get dynamic content for wordpress on a predefined theme
- Content export, reinstall and content import
- Open content directory help!
- Need help with invisible content block
- How to get the list of posts with empty content
- Why is every single HTML tag being stripped out of liveblog entries?
- Wp Some Pages content Not display in editor after move live server
- Expandable WordPress content (text) inside a post
- Add video tag to youtube link fron content
- Having a strange wordpress issue where content does not load when past a certain amount
- How to embed PDF files inside content without media_send_to_editor?
- Making a specific page wordpress compatable that is not index
- Update content on the fly
- Retrieve page content and pass to PHP?
- My UPDATED content ONLY shows when I am signed in.
- Content in footer file
- Plugin scans for images in post_content, how about “featured image”?
- Display a paragraph in the index page that won’t be displayed in the single post
- Is it possible to set the upload location to a different server?
- Display content based on an event
- Iframe only visible after log in
- How to use str_replace() outside the loop?
- Mixed Content removal from WordPress, can someone please help me with the details on how to fix it