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
- How to get ‘post_content’ without stripping tags?
- 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?
- post_content with line breaks
- Get content from one page and show it on another page
- remove tags from the_content
- 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
- How can I clear oEmbed caches for YouTube on posts as they are loaded
- Recommended Books on WordPress for Management and non-Developers?
- Total word count for posts by one author
- Split content into multiple columns using more tag?
- Get Content From Blog Page
- Show content after the first and second paragraph
- Host wp-content on other domain, much like a CDN
- Is it possible to handle a specific section of a post separately?
- How do I make certain areas editable?
- 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
- Site content not showing
- How to just show first line of content
- Hiding posts and pages in panel
- Take excerpt of the content of the post and send it as the title to create new post
- 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
- Output string using php printf
- Get the Page Content,without generating HTML
- content gets scrambled
- Conflicting post edit options under dashboard
- Disable external (3rd party) CALL (images,fonts..) in Dashboard
- Retrieve a specific number of words from post_Content
- 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?
- Why content_arr[‘extended’] removes paragraph tags?
- Hide specific content from excerpts
- How to make author box like this & add after every post?
- Hardening wordpress: wp-content file permissions?
- Extract an embedded video from the content
- same wordpress, 2 domains
- Displaying latest Posts – fixed height – Excerpt vs. Content?
- How to filter post content and force every link () made in blocks to return urldecode() with readable value?
- How to retrieve text only from a post using WP CLI?
- Missing content in Pages only
- Doctype printed on the page content
- Images are searched in the wrong path
- Remove Content Filter
- Main WordPress site with several flexible clones
- Add Attribute to p Tag of Post Content
- Post Format Default Content
- Export + Import = wrongly duplicated content
- Post titles below the post format content
- Show image on the left and content on the right using ul li
- What is the precendence of item types within WordPress
- How To Watermark Audio
- Problem with content – not loading
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Content not shown on some older browsers and mobile devices (SGS3)
- Query does not return content
- the_content() returning null in one category only, even though there is 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
- Delete/Replace words from X to Y in post content
- add share buttons above my posts without plugins
- Body-only page for a 2-page form [closed]
- How to turn each phone number within the $content to a telephone link?
- the_content() Not Grabbing All Content
- How is WordPress changing the content markup?
- custom page with post content using read more
- Changing theme removes page content in dashboard’s post main editor
- Checking post content for a shortcode, but content is being returned as empty
- 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();