Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
5answers
17k views

Post/Page Publish/Update button not clickable once I make an edit

I open a page and make an edit and the update button becomes grayed out. I have to copy all page content, refresh the page and paste it back in the page, only then does the update button become ...
0
votes
0answers
17 views

wp-update-post does not work if the title of the post is more then one word

I have two functions that should be updating a custom post types within a loop. The problem If the existing post type post title is longer then one word the posts does not update if the function is ...
-1
votes
0answers
15 views

$meta_key not work if it is a dynamic variable in update_post_meta

The Scenario I have a dynamic variables called $week_s* that in turn is made up from a variable called $week in a form as a select type. These variables needs to be use as the $meta_key value in a ...
0
votes
1answer
497 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
0answers
27 views

How can I trigger a javascript function after a post update on edit post screen in wordpress admin panel?

I use Wordpress 5.2.2 and I develop a custom theme. EDIT : On my theme I added a metabox who show an input type="text". Code in functions.php of my theme if ( ! function_exists( 'vn_add_metabox' ) )...
-1
votes
0answers
12 views

Page update error after add nav-walker

I added a bootstrap nav-walker provided on https://github.com/wp-bootstrap/wp-bootstrap-navwalker in my site it is working fine but after adding it i get an error on my page and other places when i am ...
0
votes
1answer
36 views

Set a post expiration and delete a post when expirate

I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field. I wrote the function below that I placed in ...
2
votes
2answers
426 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
710 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 ...
0
votes
1answer
2k 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
1answer
904 views

SQL / wp_update_post: change post custom field to CPT post taxonomy

the setup is as follow: I have posts with a custom field: actor = 'tom hanks' for advanced management I created a custom post type (actors) and added "tom hanks" as a post within that actors taxonomy. ...
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
19 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
125 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' =&...
2
votes
1answer
425 views

How can I stop wp_update_post messing up HTML example code?

I'm showing little pieces of example HTML/PHP code on the frontend (with syntax highlighting). The entries are displayed as FAQ custom posts, and have a plugin (CMS Tree page) to alter the menu order, ...
21
votes
8answers
25k views

Check for update vs new post on save_post action

Is it possible within the save_post action to determine whether it's a new post being created or an existing post being update?
1
vote
1answer
498 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
189 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 = $...
5
votes
3answers
7k views

Connection lost. Saving has been disabled… (Updating Posts/Pages)

I've been developing for Wordpress for a few years now without any trouble on an old XP/WAMP development server (v1.7.4) but recently have been getting the error "Connection lost. Saving has been ...
-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 ...
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. ...
1
vote
2answers
2k views

wp_insert_post_data filter hook identify current action

I have this function to set the title of a wordpress post which works properly for saving / updating posts. The major issue is that the function stops posts being deleted (it removes the title but the ...
5
votes
2answers
9k views

Programatically change post author

Given a user id, $user_id, and post id, $post_id, how can I programatically update a wordpress post author? Note: these posts are already created and the author cannot be set upon creation. Another ...
0
votes
2answers
40 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
339 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
439 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
369 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
91 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
1answer
62 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 ...
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
0answers
15 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 ...
2
votes
1answer
992 views

wp_update_post based function works on existing posts, but not new posts

I have a function that will update the title of the post based on an 'advanced custom field'. It works on existing posts, but not when I create a new post. When I try and save the post and check the ...
2
votes
2answers
881 views

Updating a post without escaping ampersands?

I've found that wp_update_post() escapes all ampersands provided in the post's post_content. I'm trying to update a post without converting ampersands to &. (I need to add plaintext URLs (...
1
vote
3answers
7k views

How Can I Set the Post Author of a Post I Just Created With PHP?

I'm using PHP to dynamically create a custom post, and I need the author to be someone other than the logged in user. I found this https://stackoverflow.com/questions/5759359/wordpress-manually-set-...
0
votes
1answer
25 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
490 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 ...
-1
votes
2answers
2k views

Update post title from external file?

I have an external script I wrote (for admins only) that loads in the following at the top: require_once('./../wp-blog-header.php'); I'm aware that it can be a plugin, but it's just not right now.. ...
0
votes
0answers
216 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
57 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
117 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
475 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
108 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
318 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
390 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 ...
1
vote
0answers
3k views

Set Attachment Image File URL as GUID

I have a form that uploads images and i want to update the GUID to be the attachment file url after WP generates the metadata. I tried to use wp_update_post, but seems that is not updating the guid. ...
0
votes
1answer
150 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
362 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....