Hi,
I am currently working on a few small utility applications to help move data from locally stored files to a locally hosted WordPress site. I am doing this through python-xmlrpc which has worked well up until this point.
I would like to pre-face this by saying that I do not have access to change any of the theme code or the ACF field settings within the site. I can simply create and edit posts.
The issue occurs from a post type that only really makes use of the ACF fields given to it and acts like an account database for users (which are separate to the actual WordPress users). When I attempt to create a new post of this post type, it will create a new post and the fields will end up filled but not actually saved to the database. I then need to press the “Update” or “Publish” button manually on the page which will save the data and allow it to be used (since the data acts as accounts, I have tested this by trying to log into the newly made account both before and after manually “saving” the data).
I am placing the values into the WordPressPost.custom_fields attribute (https://python-wordpress-xmlrpc.readthedocs.io/en/latest/ref/wordpress.html). To do this, I am using the field name rather than the field key which is mentioned in a few other threads. I tried to use the field key to make this work but it would make the post and not actually fill in any data at all.
Does anyone know why the post will not save just from the xmlrpc call and anyways that you can make that happen?
I understand that this could just be a limitation of ACF and XMLRPC in which case I have a couple options. One to use Selenium to just simulate the button press but this would be a much slower solution. Another thought I’ve had is to try and perform the same actions that the “Update” button does but externally through my own program. The only thing I’ve found so far is a call to admin-ajax.php, so if anyone has an idea of how that could be replicated that would be very much appreciated.
I would also like to add that editing posts of this type works perfectly as expected and can even edit the new posts before I have manually pressed “Update”. Although, the new posts will not function as accounts until I have pressed “Update” even after editing through xmlrpc.
I would like to share our experience regarding slowness when dealing with a large number of fields and rows in a repeater.
We have a repeater with approximately 14 fields (including 1 media field) and 300 rows in a custom post type.
The saving process takes about 5 seconds.
However, if we enable revisions for our custom post type, the saving process takes 80 seconds. The reason is that revisions re-save all 300 rows in the database, triggering thousands of hooks as well. Instead of saving only the differences, as ACF does when revisions are disabled.
So, it’s something to consider if you’re experiencing slowness issues with a lot of data on your page!
David
Hello, I have a gallery field (acf pro) on a page and when editing that page, it is very slow to open it because after saving and reloading the page, the images are displayed on full size, so the page takes 10-15 sec to refresh.
My preview size for that gallery field is set to a custom size of 250 x 250px not cropped but I tried other sizes with the same result.
I noticed that only square images are correctly resized and displayed to 250x250px (or any size that I choose on preview size setting).
Also, I’m using Shortpixel to optimize images and when I add an image on my gallery (or even refreshing the page), the optimisation and thumbnail are kind of reset (button “optimize now” is back on Media>library and it says “optimize 2 thumbnails” but I have more than 2 thumbnails).
I tried disabling Shortpixel and Regenerate thumbnails but images are still loaded in full size.
Any help on that ?
I want to create new Woo products in backend as admin (or update), without using the default WP title field.
The title (and permalink + slug) should always be created based on values selected in two dropdown boxes and one text field in ACF Pro (all are mandatory fields). When saving the product (also about 20 other custom fields) it should be created/updated and published. The title should be a combination of: “value 1 + 2 + 3”.
Changes afterwards in the products default WP title field should be ignored (maybe hide that), unless any of the three custom fields that create the title have been edited. Updates in any of the three custom fields should not only update the title when saving, but also update the permalink and slug.
I created a solution to this at least 5 years ago, but it was a slow and bad solution as I´m not a coder. I can´t find that code, but it took about 30 seconds to save a product so there were probably several errors in that code (I guess that “wp_insert_post_data” was run before the acf/save_post)! I have searched for an updated code in several forums, but I have not succeeded. I really appreciate any help with this!
WP (5.8.1), Avada (7.5), ACF Pro (5.10.2), PHP (7.4.25). Smarter code and better performance with PHP version 8.0.12?
As I explained in a previous post, I have a repeater with many fields (more than 50).
If I have more than a few rows in a post, this will probably create performance issues when saving the post, and there is no real solution except rethinking the way my fields are built.
I will consider creating separate custom post types, but I’d rather avoid it if I can so first I’ll try to reduce the number of fields. For that I need to understand some concepts on how WP/ACF work with the database.
1. Even though I have more than 50 fields on each row, many of these fields will remain empty most of the time.
– Does an empty field (that was already empty before) make saving time longer? I suppose so, since the simple fact that the field exist obliges WP to check if there is a value in it
– Does an empty field generate a lot of extra time, or is it negligible compared to a field with a value ? I don’t know.
2. Inside my repeater, I have a subrepeater that remains hidden via conditional logic.
Most of the time, this subrepeater remains hidden and empty. However, I set up a minimum of 1 row by default in that subrepeater. Should I make it 0 row by default so as it doesn’t create extra fields unnecessarily ? Will it change anything ?
3. If I’m correct about question 2, I’m wondering if I could optimize performance by “generating” custom fields only when needed (just like I “generate” fields in a post by adding the first row in a repeater).
The post I’m creating is some kind of CRM, or “project pipeline”. Some fields will be used since the creation of the post, but many others will be used only if the project goes to the next stage. Therefore, many fields will remain empty and unused for most of the posts, but slowing saving times anyway, just because they are there.
Wouldn’t it be possible to create a button to “create” these extra fields only when necessary, i.e. when going to the next stage of the project ?
If this is a viable solution, I could maybe extend this logic to other fields inside a same stage : create them only when needed.
Thank you !