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 !
Hi
Sidenote: I’ve already asked this question with a support ticket but I’m also looking for an opinion from the community
Right now I’m thinking about creating a website/webapp based on WordPress and ACF Pro. It’s a front-end posting tool: each user will be able to create a new post with acf_form and then get the permalink of the post in return.
Each post is going to have a few basic field (5) and a repeater field which contains 6 fields.
Usually users are going to add about 20-40 repeater’s row.
To my understating (correct me if I’m wrong), this means that each and every time a post is created, since WordPress adresses each custom field saving at a time, there could be about 5+(6*30) = 185 queries which start as the user click the submit button on the form.
I’m not afraid for the actual post viewing – I’ll just add a caching system. What worries me is the amount of queries: is 180-200 queries a lot?. The thing is that I’ve always been a front-end developer and I don’t have that much knowledge server-side. What I’m worried about is what could happen if, per say, 1000 users (or 10k) click the submit button at the same time on this website hosted on a normal basic hosting (It’ll probably be Siteground GoGeek or something similar in the same range.
Is it actually scalable? Will it become super slow? Will it handle the pressure?
I’m sure that whatever the task there’s always been a server able to handle it but I’ll probably have a basic one. What I was wondering is if this scenario is, generally speaking, heavy/intensive for a common/average hosting.
Thank you
Bye
Hello,
I have a PHP script that does the following:
– It returns a JSON object of (dynamic) Google places
– It saves this review data in a repeater field
– Next, this data is displayed in a carousel
The above works properly, there is one main issue though: it makes the pages laod extremely slow. Is there a way to speed this up? Please find the code below:
Please note: I am definitely not a PHP expert, so any help is much appreciated.
Thanks a lot!!
$response_accommodation = wp_remote_get( 'https://maps.googleapis.com/maps/api/place/details/json?placeid=<place_id>&fields=name,rating,user_ratings_total,review&key=<key>');
$place_id = get_field('google_place_id');
$response_accommodation_new = str_replace('place_id', $place_id, $response_accommodation );
$body_accommodation = wp_remote_retrieve_body( $response_accommodation_new );
$body_decoded_accommodation = json_decode($body_accommodation, true);
$place_accommodation = ( $body_decoded_accommodation['result']);
$number_reviews_accommodation = ( $place_accommodation['user_ratings_total']);
$grade_accommodation = ( $place_accommodation['rating']);
update_field('rating', $grade_accommodation);
update_field('number_reviews', $number_reviews_accommodation);
$reviews_accommodation = ( $place_accommodation['reviews']);
foreach($reviews_accommodation as $v) {
$review_rating_accommodation = $v['rating'];
$review_name_accommodation = $v['author_name'];
$review_date_accommodation = $v['relative_time_description'];
$review_text_accommodation = $v['text'];
$review_profile_photo_accommodation = $v['profile_photo_url'];
$row_accommodation = array(
'author_name' => $review_name_accommodation,
'review_date' => $review_date_accommodation,
'review_rating' => $review_rating_accommodation,
'review_text' => $review_text_accommodation,
'review_profile_photo' => $review_profile_photo_accommodation,
'review_summary' => substr($review_text_accommodation, 0,75)
);
add_row('reviews', $row_accommodation );
}
?>
If you have any other questions, please let me know!
I am looking forward to receiving your answers.
Cheers,
Hans
Hello everyone,
I am using ACF Pro in a self-developed theme. The backend for inserting new field values operates slow and I want to speed it up.
(I do not care about frontend loading/php-“rendering” the page – I use wp-super-cache).
The field groups are set up nicely structured, using repeater fields (with quite some nested fields in them – wysiwyg, file-uploads and others) so the customer has a good experience inserting values. Hence, the customer used the page to a great extent which led to quite some content.
The backend-page (“edit page”) takes quite some time to be ready for editing (~4 minutes). Updating/saving after a change takes even longer (~15min).
Now, what I did so far is the following:
php_value max_input_vars 8000
php_value suhosin.get.max_vars 8000
php_value suhosin.post.max_vars 8000
php_value suhosin.request.max_vars 8000
php_value memory_limit 300M
php_value upload_max_filesize 300M
php_value max_input_nesting_level 128
php_value max_input_time 600
php_value max_input_vars 8000
php_value max_execution_time 600
php_value post_max_size 300M
https://support.advancedcustomfields.com/forums/topic/js-performance-issues/page/3/
What I do not understand and only guess:
Now to the real question (“requirements”):
Is there a way to:
☞ Is there a plugin or filter/hook-workaround that can fullfil these requirements?
Thanks to everyone who read so far and is deep enough in the topic.
Every answer or hint is appreciated! 🙂
Cheers
PS: Of course I could also avoid this situation by refactoring my Theme “divide and conquer”-style.
I.e. I could split the number of repeater-fields from one page to, lets say custom post types that would resemble the outer-most hierarchy of repeater fields. By this, I would have more “posts” (with each having just a share of the total number of fields) that I would glue together as the final page. But, this would require the customer to re-learn the procedure of editing content. And most of all it would require me to refactor/migrate the Database for existing contents.
Hi,
i have serious performance issues with a repeater-field in wp-admin. Frontend runs ok. The repeater-field contains 7 sub-fields (all text). With more than 100 entrys saving became really slow (over 30 seconds).
Do you have an idea how to speed up the saving procedure?
Thanks!
Hi,
we’re having an issue with the Flexible Content field is acting very sluggish. With only 11 flexible content blocks added to a page it will take a minute to load, even more.
Looks like others have similar issues http://support.advancedcustomfields.com/forums/topic/js-performance-issues
Any hints on where to look to fix these performance issues would be appreciated.
However, our main issue is this:
If the client updates something at the top of the page (ie. an image or the title) and then hits Update before ACF has finished loading all repeater blocks, anything not loaded yet will be cleared from the page.
So, saving before ACF has loaded will delete content from posts.
Is it possible to disable the save button while ACF is loading?
Hi
This is a common question on diffrent forum about multilang support for ACF and how to get it to work. But no straight answer. What I understand you are not so familar with WPML (according to threads, but old ones I found).
When making “field groups” translatable is also have to make som fields translatable too, and the WPML box are showing A LOT of ACF fields, specially when using repeater.
The mandatory selection to “show” ACF on secondary language pages are:
-rule
-position
-layout
-hide_on_screen
They must be set to “Translate”. Then in the box, we have a lot of:
field_523e53ec1fbe0 (around 5 - 10 for me)
and this little single child: (sometimes)
-allorany
Qustion is, the 2 latter, are they “yours” and if so, what are they doing?
Second, in the main config of WPML for custom fields, all my id:s I created are listed, but also a copy with _underscored prefix. Like:
ua_mobile_shortcut_menu_tab_1
_ua_mobile_shortcut_menu_tab_1
In my case, in this setting box, around
30 st field_523e53ec1fbe0...
65 st my_ids-created_for_all_fields...
65 st _my_ids-created_for_all_fields...
All are with option “Make translateable”, “copy” or “never translate”…
Question, are the “underscored versions” yours, and if so, what are they doing?
I did a huge setup 3 years ago (dating site) with ACF buddypress and WPML, and I just checked “Everything”, but I don wanna do that this time. – couse it seems renundant, and I wanna know what Im doing. Checking randomly just make a slowing mess.
ACF is a little tricky when WPML “Dublicated mode” is in use, The “synced copy” must be updated / saved, to get all the ACF “rules” in placed. (Only the first rule is applying, but after saving they all shows up)
With a little help from you, to understand the context, I hope to deliver some aswers to other forums about this 2 plugins.
And yes for any reader, Advanced Custom Fields ACF is today 2014 compatible with WPML – WordPress Multilingual Plugin. Everything just has to be saved in the right order. You Dont have to rewrite any ACF templates.
/ Jonas