Support

Account

Home Forums Search Search Results for 'save limit'

Search Results for 'save limit'

topic

  • Unread

    ACF fields filled in with XMLRPC will not save

    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.

  • Helping

    meta_query for relationship field with array of values?

    I’m building an AJAX filtering system and am trying to include a filter that can take multiple IDs and then filter custom post type posts based on its relationship field. Is there any handy method of doing meta_query with an array of values for a relationship field which is saved as array? I’m trying to achieve something like this
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘relationship_field’,
    ‘value’ => serialize([1234, 4321]),
    ‘compare’ => ‘LIKE’,
    )
    )
    Is anything like this doable or is doing multiple OR conditioned meta queries the only option? This probably gets pretty heavy very quickly, so is there best practice on how many you should use, meaning I could probably limit how many IDs can be passed to the filtering function?
    It’s possible to filter out posts that don’t match inside the loop with array_intersect IF statement, but that wouldn’t be very good for pagination.

  • Helping

    need help with repeater

    i have a repeater field , when the post have more that 106 rows i get 404 when trying to save… before i could save more that 100 rows (they have only a few filds inside)

    when i run phpinfo i can see:
    local. master
    max_execution_time 10000 10000
    max_file_uploads 20 20
    max_input_nesting_level 256 64
    max_input_time -1 -1
    max_input_vars 20000 10000
    memory_limit 1G 1G

    i think i change this to this high values… what could it be ? i also tryed :
    /**
    * Increase ACF Repeater row limit
    */
    function my_acf_repeater_settings( $field ) {
    $field[‘max’] = 5000; // Change this value to your desired limit
    return $field;
    }
    add_filter(‘acf/fields/repeater/settings’, ‘my_acf_repeater_settings’);

    no luck .. my acf is Ver5.12.3 … can any kind soul help me? tanks

  • Helping

    Error 500 / 504 on update page with a lot of ACF fields

    We have a page where we use a lot of different ACF custom blocks / fields, including ACF wrappers.

    When we click to update this page, the whole website goes down until its fully saved – which takes half a minute to couple of minutes.

    While the update-button is loading and I go to console on the edit page it will show:
    VM2831:1 GET urlremoved/wp-admin/post.php?post=169&action=edit&message=4 500 (Internal Server Error)

    And if I open new window to see the website during this loading, it will show Database not connected. Sometimes 504 Gateway Time-out.

    The error logs say:
    PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /var/www/urlremoved/wordpress/wp-includes/wp-db.php on line 1753

    Im not sure what to do to not have this happen, we tried increasing some php settings but that didnt help.

    Server:
    File uploads Enabled
    Max size of post data allowed 13M
    Max size of an uploaded file 256M
    Max effective file size 13 MB
    Max number of files allowed 20
    Server architecture Linux 5.4.0-89-generic x86_64
    Web server nginx/1.18.0
    PHP version 7.4.3 (Supports 64bit values)
    PHP SAPI fpm-fcgi
    PHP max input variables 1000
    PHP time limit 30
    PHP memory limit 516M
    Max input time 60
    Upload max filesize 256M
    PHP post max size 13M
    cURL version 7.68.0 OpenSSL/1.1.1f
    Is SUHOSIN installed? No
    Is the Imagick library available? No
    Are pretty permalinks supported? Yes

    Database:
    Database size 208,80 MB
    Extension mysqli
    Server version 8.0.30-0ubuntu0.20.04.2
    Client version mysqlnd 7.4.3
    Database username wp_user
    Database host 127.0.0.1
    Database name wp_stage_db
    Table prefix wp_
    Database charset utf8mb4
    Database collation utf8mb4_unicode_520_ci
    Max allowed packet size 67108864
    Max connections number 151

    Wordpress constants:
    WP_MEMORY_LIMIT 516M
    WP_MAX_MEMORY_LIMIT 256M
    WP_DEBUG Disabled
    WP_DEBUG_DISPLAY Enabled
    WP_DEBUG_LOG Disabled
    SCRIPT_DEBUG Disabled
    WP_CACHE Disabled
    CONCATENATE_SCRIPTS Undefined
    COMPRESS_SCRIPTS Undefined
    COMPRESS_CSS Undefined
    WP_ENVIRONMENT_TYPE Undefined
    DB_CHARSET utf8mb4
    DB_COLLATE

  • Unread

    AJAX Blocks Call

    I have a block that I created and I am looking to update the fields based upon a date range being selected and then having that data update other data that is not touch yed.

    <?php
    
    /**
     * Composite Reports Block Template.
     *
     * @param   array $block The block settings and attributes.
     * @param   string $content The block inner HTML (empty).
     * @param   bool $is_preview True during AJAX preview.
     * @param   (int|string) $post_id The post ID this block is saved to.
     */
    
    // Global Declarations
    global $wpdb;
    
    // Create id attribute allowing for custom "anchor" value.
    $id = 'composite_reports-' . $block['id'];
    if( !empty($block['anchor']) ) {
        $id = $block['anchor'];
    }
    
    // Create class attribute allowing for custom "className" and "align" values.
    $className = 'composite_reports';
    if( !empty($block['className']) ) {
        $className .= ' ' . $block['className'];
    }
    if( !empty($block['align']) ) {
        $className .= ' align' . $block['align'];
    }
    
    // Load values and assign defaults.
    $trainee = get_field('trainee_name') ?: 'Traine Name...';
    $date_from = get_field('date_from') ?: date("01/01/2020");
    $date_to = get_field('date_to') ?: date("m/d/Y");
    $desktop_limit = get_field('desktop_limit') ?: 1000;
    $mobile_limit = get_field('mobile_limit') ?: 5;
    
    // echo $trainee . '<br>';
    // echo $date_from . '<br>';
    // echo $date_to . '<br>';
    // echo $desktop_limit . '<br>';
    // echo $mobile_limit . '<br>';
    
    $procedureDates = [];
    $traineeScores = [];
    $attendingScores = [];
    
    echo $trainee;
    
    // Composite Report Data Queries
    
    $results = $wpdb->get_results("SELECT * FROM (SELECT t1.traineeName, t1.procedureDate, t1.surgeryID, t1.traineeRemovesFatAdrenalRating, t1.traineeSkeletonizesRenalVeinRating, t1.traineeSkeletonizesArteryRating, t1.traineeDonorArteriesRating, t1.traineeRenalVeinAugmentationRating, t1.traineeOverallPerformanceRating, t2.doctorRemovesFatAdrenalRating, t2.doctorSkeletonizesRenalVeinRating, t2.doctorSkeletonizesArteryRating, t2.doctorDonorArteriesRating, t2.doctorRenalVeinAugmentationRating, t2.doctorOverallPerformanceRating FROM BackbenchKidneyChartTrainee t1 JOIN BackbenchKidneyChartDoctor t2 ON t1.traineeName = t2.traineeName WHERE t1.surgeryID = t2.surgeryID AND (t1.traineeName = '" . $trainee . "' AND t2.traineeName = '" . $trainee . "') AND " . date(t1.procedureDate) . " BETWEEN '" . $date_from . "' AND '" . $date_to . "' ORDER BY t1.surgeryID DESC LIMIT " . $desktop_limit . ") t3 ORDER BY t3.surgeryID ASC");
    //STR_TO_DATE(, '%m/%d/%Y')
    
    $overallResults = $wpdb->get_results("SELECT * FROM (SELECT t1.traineeName, t1.procedureDate, t1.surgeryID, t1.traineeOverallPerformanceRating, t2.doctorOverallPerformanceRating FROM BackbenchKidneyChartTrainee t1 JOIN BackbenchKidneyChartDoctor t2 ON t1.traineeName = t2.traineeName WHERE t1.surgeryID = t2.surgeryID AND (t1.traineeName = '" . $trainee . "' AND t2.traineeName = '" . $trainee . "') AND STR_TO_DATE(t1.procedureDate, '%m/%d/%Y') BETWEEN STR_TO_DATE('" . $date_from . "', '%m/%d/%Y') AND STR_TO_DATE('" . $date_to . "', '%m/%d/%Y') ORDER BY t1.surgeryID DESC LIMIT " . $desktop_limit . ") t3 ORDER BY t3.surgeryID ASC");
    
    $overall = json_encode($overallResults);
    
    if ( ! empty( $overallResults ) ) {
            foreach($overallResults as $row) {
    				array_push($procedureDates, "'" . $row->procedureDate . "'" );
    				array_push($traineeScores, $row->traineeOverallPerformanceRating);
    				array_push($attendingScores, $row->doctorOverallPerformanceRating);
            }
        }
    
    // print_r(array_values($procedureDates)) . '<br>';
    // print_r(array_values($traineeScores)) . '<br>';
    // print_r(array_values($attendingScroes)) . '<br>';
    
    $procedureDate = implode(', ', $procedureDates);
    $traineeScore = implode(', ', $traineeScores);
    $attendingScore = implode(', ', $attendingScores);
    
    ?>
    
    <script type="text/javascript">
    
    jQuery(function() {
      var chart = jQuery('#container').highcharts({
        chart: {},
    	title: {
        	text: 'Overall Performance'
    	},
        xAxis: {
          categories: [<?php echo $procedureDate; ?>]
        },
    
        yAxis: {
    	min: 1,
        max: 4,
        title: {
          text: 'Values'
        },
        plotLines: [{
          
    	}]
      },
    
        legend: {
    	  enabled: true,
          align: 'center',
          verticalAlign: 'bottom',
          x: 0,
          y: 0
        },
    
        credits: {
          enabled: false
        },
    	  
    	exporting: {
        	enabled: false
      	},
    
        series: [
    	{
        	name: 'Trainee',
        	data: [<?php echo $traineeScore; ?>]
      	},
    	{
        	name: 'Attending',
        	data: [<?php echo $attendingScore; ?>]
      	}]
      }, function(chart) {
    
      });
    
    });
    	
    </script>
    
    <div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?>">
        <div id="container" style="height: 400px"></div>
    
    </div>

    ;

  • Solved

    Fields are randomly not saved

    Cross post from wordpress support page

    In a shop I am working on, I created a few custom fields associated to the product post type. I have a strange issue that cannot debug further. When I publish or update the product, some of the custom fields stay empty (not updating).

    What I did for debugging:

    – Disabled all the plugins except Woocommerce and ACF
    – Changed theme to storefront
    – Disable server and website cache
    – Check server logs (nothing there)
    – Enable wp_debug and also nothing
    – Disable every custom code I had in the child theme

    What I also found:

    – The name doesn’t matter. I created a field called “Box Quantity” and I couldn’t save it. Then I delete all the custom fields and create just this one and it worked. Adding more kept this one working but not the new fields
    – Checked the database on the postmeta table and the fields values are not there. So not saved at all.

    Those are some of the server settings that might affected it. As you see, values are big enough and I even tried to increase them more with no success.

    
    PHP version	7.2.34
    PHP max input variables	6500
    PHP time limit	3600
    PHP memory limit	3072M
    Max input time	1000
    PHP post max size	260M
    WordPress Version 5.8.2
    Advanced Custom Fields Version 5.11.4
    WooCommerce Version 6.0.0
    
  • Solved

    Heavy Usage Of ACF

    Hi everyone here is my situation and question for ACF community,

    I am using ACF to make a fairly large web-app, I have 40-50 custom post types and more than 1000 custom fields in total.

    Today I am making the heaviest of the post types which has nearly 300 custom fields (those fields include calculated fields, repeater fields, pre-loaded fields if I have to count the repeater fields it’s probably more than 4000 fields in total)

    When I get past 100 fields my app started to miss some values on saving, when I save 50-60 custom fields at once, some of them didn’t save. That one time some conditional logics disappeared from my field group all of a sudden.

    So my question is, is there a limit what you can do with ACF? Or is it about my hosting plan&provider? What happens when I try to save 1000 fields at once with acf_form from the front-end app?

    Is there any other people out there making this kinda heavy projects with ACF PRO?

  • Solving

    Object Cache not working @ SiteGround

    On my server at Siteground I am using SG optimizer.

    I have to do a complete manual flush for every change to a post or a new post. Without this manual flush, changes will never be visible on my site.

    The problem is that an item added within ACF Pro (with a registered post-type) in the WP-admin looks like it’s not giving a signal to the object-cache. That way there is never a cache flush like when you save a wp-post or page. Is there a way to achieve the same result as when we’re saving a wp-item?

    I already made a support ticket. ACF confirmed the issue, but has no solution at the moment:

    Patrick Mwange replied
    Hi there,

    Thanks a bundle for the clarification. I now understand the challenge with SiteGround.

    Unfortunately, I’m afraid there is currently no option out of the box from the ACF end to resolve this limitation. I’m going to share the same with the dev team as well for further consideration.

    In the meantime, I would recommend that you also open a forum thread on the same. Someone else may have implemented a custom solution that might.

    My apologies for the inconvenience.

    Maybe someone has a possible solution/workaround already?

  • Solving

    WYSIWYG always defaults to text mode

    Users editing custom post types with ACF WYSIWYG’s on the screen are always defaulting to the “Text” tab. Changing to another tab does not seem to save as the default. This is a recent problem that seems to only be limited to users within a new user role we created that has the following capabilities:

    Copy posts, create posts, delete others posts, delete posts, delete private posts, delete published posts, edit others posts, edit posts, edit private posts, edit published posts, manage categories, moderate comments, publish posts, read, read private posts, unfiltered upload, upload files

    Admins and editors are not having a problem. Any advice on how to fix or troubleshoot this? Thanks!

  • Solving

    ACF 5.8.13 (Free) + WP 5.4.2 – Cannot add more than 10 fields to a field-group

    Hello,

    I am trying out the ACF 5.8.13 (Free) version on WordPress 5.4.2. This is a local machine install on Ubuntu + MySQL 8.0.21.

    The problem is that I am unable to add more than 10 (ten) fields to a field group. When I add an 11th field and hit the UPDATE button, the message alert on the top says that the fields have been saved. But, when the field-group refreshes, it only has the first 10 fields.

    What I have tried:

    1. Create a fresh field group that is not bound to any post type (post type query is blank).

    2. Created a field-group, added 10 fields, exported it to JSON (using the Custom Fields > Tools > Export Field Groups), added the 11th field to it using a text editor. Deleted the original field group from WP-ADMIN, cleared it from Trash as well. Imported the modified JSON using the Custom Fields > Tools > Import Field Groups.

    I also attempted to trace through the code to figure out what was going on, but with so many filters and nested logic, it was kind of hard to get anywhere. However, I did confirm that both the acf_update_field() and acf_update_field_group() functions were doing their job. In both cases, the fields were reported as committed to the database.

    Interestingly, I can see that in the WP_POSTS table in the database, these fields ARE PRESENT. But they do not show up on any UI !

    Is this a limitation of the free version?

  • Helping

    Is there a limit on amount of custom fields? Won't save my last 8 fields

    So I have a very complex set of custom fields, but have had no problems with it. Recently I’ve just tried saving them and repeatedly it deletes/changes fields when I save.

    Firstly, random empty text fields are being added on the top level.
    On the most inner level, the last 8 fields are not adding at all,
    and the location rule is setting to default.

    Could their be some kind of data limit that is causing this strange behaviour?

    I’ve just updated and seeing exactly the same behaviour

  • Solving

    Issue with radio field type not saving selection & entering new choice instead

    Hi. I’ve got an issue when using a radio field type. I’m not sure if it’s a bug, or a limitation with what I’m trying to achieve.

    I have a list of choices, where I specify both a “value” and a “label” for each. The value is a code snippet that creates a button with a custom link (see image1). I have done it this way as the Elementor plugin I use cannot dynamically reference choice field types for URLs. As you can see, I also have the “other” and “save other” options checked, to allow me to add more links directly from my wordpress posts.

    My issue occurs when I’m in a post and select one of the radio button options that I created above. After I save my choice and refresh the page, it ends up ignoring my selection and instead creating a new option using the button text name (see image2).

    I’m guessing there’s some conflict going on with the use of a code snippet as a value, but I’m not sure what it is.

    When I turn off the ability to add and save “other” values, it then seems to correctly save the radio value, but this makes it inconvenient as I need the option switched on.

    I’ve also tried disabling all other plugins as well, to check for any conflicts, but the issue persists. It seems to also happen with the “checkbox” field type as well.

    I’d much appreciate some guidance. Thanks.

  • Helping

    ACF Gutenberg Blocks vs regular ACF Fields

    Hi,

    Does anyone have any clear examples (or maybe a link to an article) for why/when one would use ACF Gutenberg Blocks (i.e. later referred to as Blocks) vs using default/regular ACF Fields (i.e. later referred to as Metaboxes)?

    Besides an obvious “visual builder”-alternative appeal of Blocks, I can’t help but focus on the fact that Blocks store data as HTML comments in the post_content, while Metaboxes store all data as separate entries in wp_postmeta. And that’s such a big difference. So I want to understand all of the nuances, advantages & disadvantages of each method.

    Has anyone written a detailed article with a breakdown of each method, when/where it’s appropriate to use them and what limitations each method has?

    I already can think of a few issues, but maybe I am missing some, so I want to reference other people’s opinions.

    For example:

    1) When it comes to Blocks, it seems that they would be much faster at data retrieval by default, because the data is stored as one big “blob” inside post_content. Which means that, theoretically, we only need 1 database query to get all of the content & ACF fields data. So that means that if you intend to have very complex pages with lots of ACF fields, you should use Blocks. So that’s a clear advantage over regular meta fields.

    Or is it? Because yes, if you use regular ACF fields and a default ACF get_field() function, that would query wp_postmeta for each piece of data separately. Which is bad (possibly even very bad). But if you use `<a href=”https://developer.wordpress.org/reference/functions/get_post_custom/”>get_post_custom()</a&gt; you’ll get all of the post meta data at once and not suffer any performance punishment whatsoever (since that function also caches data, so it’s lightning fast for each consecutive request).

    So seems like performance-wise both can achieve the same results. Or am I wrong?

    <strong>2)</strong> Blocks seem to have a downside to storing all of the data inside post_content, because <strong>(a)</strong> I can’t easily query that data from another page/post and <strong>(b)</strong> individual custom fields are not de-coupled from post content itself. I’ve read in the Q&A that you can “load the post_content of a given post, and then parse the blocks using the parse_blocks() function” which seems reasonable, but how efficient is it? Also, if I wanted to pull a dozen pages somewhere, based on a matching meta value, that would be pretty easy & “cheap” (resource-wise) to do with Metaboxes and a custom WP_Query. But what about doing something like that using Blocks? How expensive would it be? Would that even be possible? Seems like I’d have to pull ALL posts, loop through each one, run parse_blocks() on EVERY post and only that way I’d find the posts with my desired ACF field value. Seems like that would be super expensive & CPU time consuming to do.

    Or I am thinking about it completely wrong and my use-case for Blocks is completely inappropriate?

    <strong></strong>3)</strong> Another issue I can see with Blocks is if data is hardcoded into post_content, does that mean that I can’t change a ACF field output type (i.e. if I want to change the output of an ACF file field to return attachment ID, instead of a URL)? With Metaboxes, I can just use get_field('field_name', $post_id, true) and get the ID no matter what the original output type is in ACF. But if it’s saved a Block as a URL, does it mean it’s hardcoded into the post_content and the only way to change it is for me to update the block template & then also manually update/re-save every page where it was used?

    I think most of these issues stem from my lack of understanding of where I should be using Blocks vs Metaboxes. Hope someone can enlighten me.

    Cheers,
    Alex

  • Unread

    When should we use Blocks?

    Hi,

    Can someone please give some clear examples (or point me to an article) of why/when one would use ACF Gutenberg Blocks vs using regular ACF Fields (i.e. metaboxes)?

    Besides an obvious visual appeal of ACF Gutenberg Blocks, I can’t help but focus on the fact that Blocks store data as HTML comments in the post_content, while regular ACF fields store all data as separate entries in wp_postmeta. And that’s a pretty huge difference. So I want to understand all of the nuances, advantages & disadvantages of each method. Has anyone written a detailed article with a breakdown of each method, when/where it’s appropriate to use them and what limitations each method has?

    I already can think of a few issues, but maybe I am missing some, so I want to reference other people’s opinions.

    For example:

    1) When it comes to Blocks, it seems that they would be much faster at data retrieval by default. Because the data is stored as one big “blob” inside post_content. Which means that there is theoretically only 1 database query to get all of the content & custom field data. So that means that if you intend to have complex pages with lots of ACF fields, you should use Blocks. So that’s a clear advantage over regular meta fields.

    Or is it? Because yes, if you use regular ACF fields and a default ACF get_field() function, that would query wp_postmeta for each piece of data separately. Which is bad (possibly even very bad). But if you use `<a href=”https://developer.wordpress.org/reference/functions/get_post_custom/”>get_post_custom()</a&gt; you’ll get all of the postmeta data at once and not suffer any performance punishment whatsoever (since that function also caches data, so it’s lightning fast for each consecutive request).

    So seems like performance-wise both can achieve the same results. Or am I wrong?

    <strong>2)</strong> Blocks seem to have a downside to storing all of the data inside post_content, because (a) I can’t easily query that data from another page/post and (b) individual custom fields are not de-coupled from post content. I’ve read the Q&A that said that I can “load the post_content of a given post, and then parse the blocks using the parse_blocks() function” which seems reasonable, but how efficient is it? Also, if I wanted to pull a dozen pages somewhere, based on a matching meta field value, that would be pretty easy & “cheap” (resource-wise) to do with a custom WP_Query. What about doing it in Blocks? How expensive would it be? Would that be even possible? Seems like I’d have to pull ALL posts, loop through each one, run parse_blocks() on every post and only that way I’d find the ones with my desired custom field value. Seems like that would be super expensive & CPU time consuming to do.

    Or I am thinking about it completely wrong and my use-case for Blocks is completely inappropriate?

    <strong></strong>3)</strong> Another issue I can see is if data is hardcoded into post_content, does that mean that I can’t change a custom field output type (i.e. let’s say I want an ACF file field to now return attachment ID, instead of a URL). With regular fields, I can just use get_field('field_name', $post_id, true) and get the ID no matter what and manipulate it how I want. But if it’s saved in a Block as a URL, does it mean it’s hardcoded into the page and the only way to change it is for me to update the block template & then also manually update/re-save every page where it was used?

    I think most of these issues stem from my lack of understanding where I should be using Blocks vs Meta fields. Hope someone can enlighten me.

    Cheers,
    Alex

  • Helping

    Blocks vs Metaboxes

    Hi,

    Can someone please give some clear examples (or point me to an article) of why/when one would use ACF Gutenberg Blocks vs using regular ACF Fields (i.e. metaboxes)?

    Besides an obvious visual appeal of ACF Gutenberg Blocks, I can’t help but focus on the fact that Blocks store data as HTML comments in the post_content, while regular ACF fields store all data as separate entries in wp_postmeta. And that’s a pretty huge difference. So I want to understand all of the nuances, advantages & disadvantages of each method. Has anyone written a detailed article with a breakdown of each method, when/where it’s appropriate to use them and what limitations each method has?

    I already can think of a few issues, but maybe I am missing some, so I want to reference other people’s opinions.

    For example:

    1) When it comes to Blocks, it seems that they would be much faster at data retrieval by default. Because the data is stored as one big “blob” inside post_content. Which means that there is theoretically only 1 database query to get all of the content & custom field data. So that means that if you intend to have complex pages with lots of ACF fields, you should use Blocks. So that’s a clear advantage over regular meta fields.

    Or is it? Because yes, if you use regular ACF fields and a default ACF get_field() function, that would query wp_postmeta for each piece of data separately. Which is bad (possibly even very bad). But if you use `<a href=”https://developer.wordpress.org/reference/functions/get_post_custom/”>get_post_custom()</a&gt; you’ll get all of the postmeta data at once and not suffer any performance punishment whatsoever (since that function also caches data, so it’s lightning fast for each consecutive request).

    So seems like performance-wise both can achieve the same results. Or am I wrong?

    <strong>2)</strong> Blocks seem to have a downside to storing all of the data inside post_content, because (a) I can’t easily query that data from another page/post and (b) individual custom fields are not de-coupled from post content. I’ve read the Q&A that said that I can “load the post_content of a given post, and then parse the blocks using the parse_blocks() function” which seems reasonable, but how efficient is it? Also, if I wanted to pull a dozen pages somewhere, based on a matching meta field value, that would be pretty easy & “cheap” (resource-wise) to do with a custom WP_Query. What about doing it in Blocks? How expensive would it be? Would that be even possible? Seems like I’d have to pull ALL posts, loop through each one, run parse_blocks() on every post and only that way I’d find the ones with my desired custom field value. Seems like that would be super expensive & CPU time consuming to do.

    Or I am thinking about it completely wrong and my use-case for Blocks is completely inappropriate?

    <strong>3)</strong> Another issue I can see is if data is hardcoded into post_content, does that mean that I can’t change a custom field output type (i.e. let’s say I want an ACF file field to now return attachment ID, instead of a URL). With regular fields, I can just use get_field('field_name', $post_id, true) and get the ID no matter what and manipulate it how I want. But if it’s saved in a Block as a URL, does it mean it’s hardcoded into the page and the only way to change it is for me to update the block template & then also manually update/re-save every page where it was used?

    I think most of these issues stem from my lack of understanding where I should be using Blocks vs Meta fields. Hope someone can enlighten me.

    Cheers,
    Alex

  • Solved

    Repeater can't display (and save) more than 225 rows in wp-admin

    I have a simple PHP import function that creates ACF repeater rows and populates them with data. I am working with 1500+ rows. After running the import function, everything displays just fine on the front-end (e.g. 1900 repeater rows).

    However, when I open the admin option page in which the ACF repeater is set to be displayed, it is only able to show 225 rows and no more. The problem is, if I click ‘Update’ button on this option page, every row (except for those 225) gets deleted.

    Is there some limit? Is it possible to turn it off?

    These are my PHP settings:

    max_execution_time = 600s
    memory_limit = 512M
    post_max_size = 256M
    max_imput_vars = 1000

  • Solving

    Building a Game with ACF FORM

    To be clear I am not asking how this would be done with ACF or exactly how to pull it off any part of it I understand it is a complex concept and I’ve slowly been trying to figure it out (its a project for a visual artist), I’m just wondering if anyone could read the description below and see if ACF is even capable of achieving something like this. I understand that there is a lot of information missing here, so I’ve just tried to outline the core concept to see if I’m completely going down the wrong path trying to achieve this with acf, or if a capable ACF / JS front end dev would be able to tackle something like this – I’ve been developing with ACF for years but in a pretty traditional capacity.

    Essentially I’m trying to make a game using ACF that consist of four questions that would each live on a separate page. The game could only be played by a registered user on the site, and could only be played one time. Additionally once a step of the game is played, it is locked the result is saved to the user’s profile and cannot be modified or repeated by the user (e.g. a multi-step form would not work because the user could refresh before submitting the whole thing to change an earlier step)

    Outline of the game (for context it’s an online project for an exhibition that is a bit of institutional critique about the art market – so the concept is a user is “gambling” to win pieces of art, but no actual transaction is happening)

    Page 1. Roll the dice (this would a button that the user would click and they would get a random value from a select field (1-6), this determines the number of ‘sculptures/works’ they are playing for (e.g. 1 work, 6 works, etc)

    2. Flip a coin, same logic a single button you get a random result after clicking (heads/tails) this determines whether the price is in hundreds or thousands

    3. Roll a 24 sided die same logic as step one, click a button get a number at random from 1-24 – this determines the final price they are playing for (eg. rolling a 13, with tails is 29 thousand dollars)

    4. Pick Numbers (kind of a lottery ball concept) based on the result from Step one. If they, for example, rolled a 5, there would be 5 buttons on this page, that would pull at random artworks which would be the art that the user wins/is playing for. The initial idea is that the artwork would exist as a CPT (so clicking the button you would pull in a random post and save that to the users’ record) and that as the game is played when an item is selected the status would change form available to won.

    Again totally thankful if anyone actually read this far, and just want to know if this type of challenge is even worth pursuing or if there are fundamental limitations here and it would be better to avoid ACF in this case.

  • Solving

    ACF Field for \'Add Elementor\' Button

    Is it, or will it ever, be possible to have a field on any post, where you can add an elementor field that gets saved as an acf meta, and then you can call on it and spit out the html/elementor data wherever you want on the template.

    Yes I know you can use elementor anywhere, and I have been using. but on a large site constantly going to another area to do some edits, and then pasting the shortcode/number into an acf field that gets generated it tedious.

    Also I know you can have an element called in the template and then use ACF to dynamically fill those fields, but that requires static fields and limits what you can do.

    archive-product.php for example. I am using the wysiwyg ACF field on there, but I would like some more flexibility on the content use in woocommerce_archive_description

    p.s ACF is the bomb and i love it.

  • Unread

    ACF pro version Required?

    Hello, I am using ACF free version 5.5.11 for adding blogs. I am trying to add new blogs but newly added blogs are not getting saved. There is no issue with existing blogs.Is there any limit that is set for free version. To resolve this issue should I need to purchase ACF Pro?

  • Solved

    Resrict valid formats in WYSIWYG editor

    Hi all,

    Is there any option to restrict the format (HTML codes) that is saved within the visual editor in ACF?

    I already restricted the Toolbar to a very limited set of formatting options. However, any kind of annoying formats can be accidentally introduced by copy-pasting formatted text from some where else.
    The original TinyMCE has the option extended_valid_elements, that can define valid HTML markup.

    Is it possible to define such an option in AFC as well?

  • Unread

    Struggle with Taxonomy field query

    I have a CPT for ‘Staff’ and a custom Taxonomy for ‘Department’ with three Terms (only three deparments). I need to be able to display the staff for each department on individual pages in addition to a page that displays ALL staff separated by department, but due to limitation with the Theme they selected (and insist on keeping) I can only use ONE template file for all of those 4 pages.

    SO on each of those pages I added a Custom Field for the Taxonomy Term to be displayed as a checkbox on the page (back-end) – the three department pages have only 1 box checked, for their department’s term, and the ‘all staff’ page has all three terms checked.

    Now I’m writing the query for the Template file and that’s where I’m struggling, if I don’t try to do a tax query to match the Custom Field’s stored term(s) to the employees stored term, I can display the page fine with all employees separated by department, that’s a simple loop that queries the custom post type and orders it by term…..it’s when I try to pull the stored term(s) for the Page and then compare it to the stored term(s) for the staff that I get no results at all.

    In the settings for the Field Group, I have ‘save terms’ and ‘load terms’ both set to yes, and the the Return Value is Term ID.

    I’m hoping someone can help me troubleshoot my code, which is this:

        while ( have_posts() ) : the_post();
    ?>
     	<h2 class="main-title"><?php the_title(); ?></h2>
           <div class="entry-content"><?php the_content(); ?></div> //This is some text about the department and its functions, etc. 
    
    <?php global $post;
    
    $tax_terms = get_field('related_staff_category');//this is the ACF field attached to each of the affected Pages
    
    if ($tax_terms) {
      foreach ($tax_terms as $tax_term)  {
        $args=array(   // Here is where I'm trying to query for staff within each department term
          'post_type' => 'staff',
          'post_status' => 'publish',
          'posts_per_page' => -1,
    	 'tax_query' => array(
                array(
                'taxonomy' => 'staff_category',
                'field'    => 'term_id',
                'terms'    => $tax_term,
    			'compare' => 'LIKE'
    			),			
             ),
          'meta_key' => 'sort_order',
          'orderby' => 'meta_value_num',
          'order' => 'ASC'    );
        $qry = null;
        $qry = new WP_Query($args);
        if( $qry->have_posts() ) { 

    Below that is the code/html that displays each staff member with their title, image, and bio.

    It *should* pull the term IDs from the data stored in the ACF field for each page (I’ve verified that it is storing the data correctly in a serialized string in each Page’s metadata), then compare to the stored term ID for each Staff member, and display those that match the Page’s term ID(s)…..but it’s not.

    Can anyone see what I’m doing wrong? Thanks in advance for any suggestions!

  • Solved

    Repeater data in database

    Hey, I’m using ACF PRO v5.8 and I’m struggling with getting ACF data from database. I’ve read other topics and resources where specific fields are stored, but I have troubles getting to that fields.

    To start with I’m trying to get to specific fields via terminal using this query:
    select * from wp_postmeta where meta_key="repeater_name" limit 10;

    It isn’t working for me though, I’m getting no results for my repeater. I want to retrieve values of specific fields and save them to other database fields related to my custom post type.

    If possible, please clarify what and where is stored by ACF.

  • Unread

    Switch to ACF with existing wp_postmeta values

    I really want to get rid off a few plugins and switch over to ACF Pro. BUT: I don’t know, how to do that.

    What I want:
    Repeater field on posts with myfield_name and myfield_url so i could add multiple Name-URL combinations. (no problems here)
    Import OLD DATA.

    What I have:
    Old plugin saved this info in wp_postmeta like this – even with empty value when no input was done:

    meta_id -> …
    post_id -> the post_id where this info was saved
    meta_key -> name_of_the_plugin
    meta_value ->

    
    myfield_name1||myfield_url1 
    myfield_name2||myfield_url2 
    myfield_name3||myfield_url3
    ... 
    

    So old plugin used 1 row for unlimited “repeater value pairs”. Maybe there’s someone who knows how I could transport the “old information” and export to ACF.

  • Solving

    Better management of flexible layouts

    On the site I’m currently building I make extensive use of ACF flexible layouts. Every page on the site is built using them. I have 26 layouts so far and managing them all has quickly become a bit of a nightmare.

    Aside from the field ordering bug I experience every time I or my co-developer update the fields, opening the custom fields page that includes all these layouts has become slow because there’s just so many subfields.

    I have an idea of how this could be better managed. I don’t know how this would work in code; I’m more of a front-end dev and my PHP knowledge is limited. But this is what I propose:

    Treat flexible layouts more like Field Groups.

    The way I’m thinking about this, there’d be a new admin page from which you could create and manage layouts. Each layout would have its own page for editing, just like Field Groups do now. That way no matter how many layouts you have, when you just want to edit one layout you can easily zero in on the fields you need to look at without loading up dozens of them. Plus, if each layout had its own local JSON file, syncing layout changes may be more robust (and less likely to trigger bugs like the reordering one linked above).

    Then, when you want to add a flexible content field to a page, you add it just like you do now. But instead of a full field management interface for the layouts, you’d see an interface that would allow you to choose which existing layouts would be available to this particular flexible content field. I imagine the UI from the current Relationship Field edit screen would work well for this.

    A system like this could potentially even open up more flexible layout options using nesting. You could have a series of layouts like ‘one column block’ ‘two column block’ etc, and each column within those layouts could be flexible content fields that can then have different layouts added within them.

    I know I’m not great at explaining this kind of thing, so if it would help I’d be happy to make a visual mockup of how it could work. I also realise this would involve quite a significant amount of work.

    So, ACF devs, what do you think?

    Cheers!

  • Solving

    Escaping & in text fields

    I have an issue with character limits on text fields.
    My character limits are set by using John Huebner’s plugin ACF Input Counter (the plugin has nothing to do with the error).

    An & (ampersand) gets ‘changed’ (by ACF) to & when it’s saved, which is of course understandable, because it’s an unsafe character.

    BUT the problem is, when you use a & character and reach the character limit, you can’t save it, because on save 4 characters are added and thus the length of the string is too long.

    I tried to ‘not escape’ an & with kses but this didn’t work. Does anyone know a way how to do this ?

Viewing 25 results - 1 through 25 (of 222 total)