Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [wp-update-post]

The tag has no usage guidance.

0
votes
1answer
27 views

Update all WordPress posts's title and content then display them in a table

I am trying to update all the WP post title and content then show the just updated post to a table. I am using the following code but it does not work: $args = array( 'post_type' => 'post', '...
0
votes
1answer
18 views

Update around 200,000 posts

So I have recently migrated from a regular site to a wordpress CMS all via MySQL. I successfully was able to adapt the old database with that of WordPress. Now, the site has content in 3 languages. ...
0
votes
1answer
59 views

Why wp_update_post() does not update GUID?

I'm trying to update GUID on a attachment. But somehow it's not working neither it's throwing any error. Example Code: $my_post = array( 'ID' => 45, 'guid' =&...
0
votes
1answer
87 views

Update status, meta while inside a post using AJAX button

So I am trying to click a custom button I made in a meta box the fire off AJAX. All works except getting the ID of the post and the refreshing of the page. I have tried using global $post; $post_id = $...
0
votes
0answers
23 views

2 pages falied to update after installing Gutenberg

I have been updating a ton of client's Wordpress sites to the newest version and all has been going smoothly except for this one. There are 11 pages on this site and all but 2 updated with no issues. ...
0
votes
2answers
38 views

How to automatic update date and time when save custom post type

I need to update date and time when I save posts. I see the code on the following thread, but I need to have this trick only for posts contained in my custom post 'new_cpt' Is it possible? ref: ...
0
votes
1answer
17 views

How to update the children of a post?

i found nothing about it in the WP reference and Google, so i ask you: I want to update a post by a form - and with it its children. $post = array( 'ID' => $mainid, ...
0
votes
1answer
279 views

Post meta data not showing in frontend, until hitting 'update' button

I try to insert around 2000 video-posts into WP. There is a custom field in the theme for the video-url, so I add the video-url to the post meta data with the corresponding field name. ACF seems not ...
0
votes
1answer
316 views

Inline style HTML attribute is being stripped from all elements of a post

I am attempting to publish HTML generated from an external party within Wordpress, but I am getting very inconsistent results with style attribute on all HTML elements, in that if I programmatically ...
1
vote
1answer
332 views

What's the proper way to use a custom table? [closed]

I manually added a table to my wordpress database using sql using CREATE TABLE. I want to add functions for adding, modifying, and removing the data from this table just like with wp_update_user(). ...
2
votes
1answer
71 views

Can I edit the wp_post > post_content right before its inserted/updated?

I would need to apply some sort of encryption on whatever gets inserted in the wp_post > post_content, so I was wondering if there is a way, either modifying the core (rather not), or using some ...
0
votes
0answers
38 views

Programmatically create draft of existing post

Hi wordpress community, What I am trying to do is programmatically create an updated draft (not live) of a published post - so that the changes will be recorded but not published. Right now, my ...
0
votes
1answer
53 views

Frontend form with multiple posts

I've been researching frontend post-editing/creating forms, but I can't seem to find anything about having multiple forms on the same page. Please excuse my shaky understanding of POST methods. Here ...
0
votes
0answers
12 views

recursively update content

the problem I'm trying to translate a wordpress 4.7. But the site was consived in spanish and just now I installed the WPML plugin, now after 5000 post uploaded. I am using the visual composer and ...
0
votes
1answer
24 views

Updating my Post when expiry date is past

I have done some more reseach and come accross the following article which does exactly what I want it to do. According to the writer, the code works but when I try and adapt it to my circumstance it ...
1
vote
3answers
436 views

Clear cache on post of one type when something happens to post of other type

EDIT: Based on @TimHallman's answer I have a follow-up question, please see the bottom of this post. I am trying to do something that is way over my head and the more I think of it, the more ...
1
vote
0answers
30 views

When User Meta amended update Title and Slug of Post programatically

I have this code below which works perfectly, i.e. when adding a new User a post is programatically created in my CPT. add_action( 'user_register', 'add_member_employees' ); function ...
0
votes
1answer
1k views

How to change post status from “draft” to “publish”?

My script uses code to set post content. I am also running the WP To Twitter plugin, to auto-tweet those posts. The problem is, whilst the plugin is correctly formulating its tweets using the default ...
0
votes
0answers
199 views

Bulk Post update_post_meta

how can use this code for update just post_meta ? here my code : function update_all_posts(){ $args = array('post_type'=> 'post', 'post_status' => 'publish', '...
0
votes
1answer
52 views

Cannot update page - with too many characters?

I have problem with page update. I am tring to save more than 14230 characters. After "update" worpress is moving me to "Posts" page. I show this issue on this video: https://youtu.be/3Y8qgFEizBU ...
0
votes
1answer
112 views

wp_update_post ignores if/else

I have a function that publishes a post if it exists as a draft. But the wp_update_post function seems to ignore the if/else and runs before anything else. $post = get_posts(array( ...
0
votes
2answers
415 views

update flamingo_inbound post type after insert

I'm having a difficult time trying to update the flamingo_inbound post author after insert. Basically, I have a hidden field in CTF7 for the company name that is being sent over and correctly stored ...
0
votes
1answer
88 views

Mass Update lines of code for all posts

Bit of a conundrum today. I implemented some query string into my website so I'd like to retroactively update all my previous (600+) posts to update specific hyperlinks to include this query string. ...
0
votes
1answer
291 views

wp_update_post to set post IDs to drafts not working

Specifically WooCommerce Product Pages. I'm using WP_Query to generate the array. $params = array( 'posts_per_page' => -1, 'post_type' => 'product', 'orderby' => 'menu-order', ...
0
votes
0answers
367 views

$wpdb->update query incrementing value on it's own!

I want to get value of column and increment it by 1. After increment, update the value in column.For example: In column post_likes the current value is 4. I am incrementing it by 1(like this $var++). ...
0
votes
1answer
19 views

Front Page post mirroring revisions to other pages, constantly updating itself

The site I'm working on has a very strange problem. When any page is updated, the Front Page is updated with the same content. Changing what page is set to the 'Front Page' seems not to matter. I ...
0
votes
1answer
474 views

How trigger to save post when updating post meta

I have very confused situation. I have added posts and all posts metas from one website db to another one, everything is fine, images, title, description of posts are there. But post metas are not ...
0
votes
1answer
125 views

save_post affect creation and deletion

I wrote a little bit of code to update the post name and slug (of my cpt) when saving. This is working nice when I update a post. I just noticed theses few lines are affecting the creation and ...
0
votes
1answer
334 views

Use /prefix/postname as a slug in post_name?

I have a custom field that I would like to use as the post's slug. I'm able to get the custom field to be used as the slug for the post but I'm having problems attaching a /prefix/ before the postname....
1
vote
2answers
196 views

How to update all posts but the current one (post__not_in not working?)

I'm trying to unpublish (set post_status to draft) all posts when a new one (with specific conditions that don't really matter right now) is published. Here's what I currently have: function ...
1
vote
0answers
174 views

how to transition to custom post status on post save

I'm trying to add a custom post status "Needs Review" for posts/pages that have been updated by an editor, so that admins can easily see what has been updated and review the changes. The planned ...
0
votes
1answer
392 views

wp_update_post meta causing 500 error

I'm troubleshooting a client site on GoDaddy and I have this strange issue that when I try and run update_post_meta the server throws a 500 error accompanied by this error message: Fatal error: Call ...
3
votes
2answers
370 views

Update post date on every new comment?

I would like to update a post on every new comment, so that the Last Modified Date is always up to date on the sitemap. How can i do this? Thanks.
0
votes
1answer
18 views

how to update editor content from metabox

hello am trying to update and add editor content from metabox not using the default editor so i tried to use wp_update_post($array); but doesn't work it cause issue Fatal error: Maximum ...
3
votes
2answers
166 views

Keeping post_date same as the pending post_date on privately publishing the post

I'm saving my CPT in private status. So the transition would be from pending to private. Thing is, when the post was first submitted and is pending there's a date of that submission on the post_date ...
0
votes
3answers
500 views

What does wp_update_post() do that the $wpdb class does not?

I recently had to make direct changes to my wp_posts table from a WordPress plugin. I first tried to do this with wp_update_post(), thinking that would would do it. Apparently, wp_update_post() is ...
1
vote
1answer
134 views

“Internal Server Error” with wp_update_post

I am coding a plugin for one of my sites which will toggle two pages statuses when a button is pressed. So when the ON button is pressed it will turn one page to draft while publishing the other, and ...
4
votes
2answers
781 views

What are the limitations of wp_update_post()?

I have two fields in wp_posts table that wp_update_post() seems to be unable to change. I'm trying to use the following code: $echo $group_access; $echo $tag_list; $my_post = array( 'ID' ...
2
votes
4answers
5k views

Unable to modify(update) posts - Page not found

For couple of days I am experiencing issues with modifying some of my posts. When I try to modify the content of post, I get 404 error, redirecting me that page is not found. Doing Google research, ...
0
votes
1answer
484 views

Updating post_parent by id (many times)

How can I update post_parent by ids? I tried: add_action('init','updating_parent'); function updating_parent(){ $args = array( 'post__in' => array(208,51) ); $my_posts = ...
0
votes
1answer
93 views

Is there a before_save_post hook or something similar

I need to check the value of a post status before is changed during a post update or even bulk update. And then depending on that value, adjust other values of the post Example: Lets say I have a ...
0
votes
1answer
674 views

Update button (sometimes) greyed-out

I'd say about 50% of the time when I edit a post the 'update' is greyed out. What I do is copy the mark-up, refresh then re-apply and publish which is a bad work-around because it doesn't address the ...
1
vote
0answers
56 views

why wp_update_post cant update when value is empty?

this runs successfully: wp_update_post( array('ID' => $postid, 'post_content_filtered' => 'something' ) ); but this doesnt update: wp_update_post( array('ID' => $postid, '...
1
vote
1answer
235 views

Change sticky status of posts from phpMyAdmin

I have many sticky posts in my database. Is there any SQL function which I could use from phpMyAdmin to change (remove) sticky status of posts, if post is sticky to change it to not sicky.
-1
votes
1answer
2k views

Fatal error: Call to undefined function wp_cache_get after update attempt

I received the following error after attempting to update my WordPress to the latest version Fatal error: Call to undefined function wp_cache_get() in /home/fairmftt/public_html/wp-includes/option.php ...
1
vote
0answers
382 views

update a post with wp_update_post

I am using a wp_update_post to change the status of a post from published to pending using wp_update_post( array( 'ID' => $post_id, 'post_status' => 'Pending', ) )...
0
votes
1answer
640 views

Can't update WordPress Page if post_content is Empty

I'm having an issue with WordPress where the Page isn't Updating if the Visual Editor is Empty. Here are the steps I am taking: Go to Pages Click on an existing page to Edit On the Edit Page screen, ...
1
vote
0answers
81 views

wp_update_post() blank screen

i am developing in functions.php a function which, when a post in a certain category is created/edited, will create also a related page or update it if already exists. The creation of a new page with ...
0
votes
1answer
829 views

How to catch and modify custom field values when a page is updated

I'm trying to find how to intercept the values in some custom fields on a page when they are being saved. I have searched and found out how to add a hook to the functions file to get the standard ...
1
vote
1answer
349 views

wp_update_post using post_name

Can I update posts using the post_name (slug) instead of the ID, as I don't have a list of the ID's, but I do have the list of the slugs and the corresponding changes for each one?