Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

topic

  • Solving

    Force JSON Field Group Only

    Two question:

    1. Is there a way to “disable” field group editing and only use the field groups defined by json in the acf-json folder? The reason for this is to prevent users from making changes on the site, as oppose to the JSON file which is version controlled and synchronized across the different environment via CI/CD.

    2. Is there a way to delete the “database version” of a field group but retain the JSON version? When a user unknowingly makes an ACF change in the admin dashboard, it overrides the JSON version. We’ve been resolving this issue by deleting the field group (which also deletes the JSON) and then redeploying. Ideally, there’s a better way.

  • Unread

    Filters not showing pages

    Hello!
    I am having trouble with the filters displaying pages (which happen to be sub-pages).
    We are trying to create a row that shows all of the clients we have worked with and provided services for. We created sub-pages for each client showcasing each service we have provided for them.
    We want users to be able to see the Client’s Parent Page and then be able to filter and select a service (sub-page) to view all the clients we have offered that service for.
    This is being created with the Advanced Query Loop with the Kadence Theme.

  • Unread

    Flexible Content on another page

    Why doesn’t this work?

    I’m trying to get flexible content from another page.

    <?php
    $post = isset($args['post']) ? $args['post'] : null;
    print_r( get_field('blocks', $post) );
    // Prints the content of 'blocks', I can see [acf_fc_layout] => my_block
    
    ?>
    
    <section class="blocks">
    
        <?
        if( have_rows('blocks', $post) ):
    
            echo "Is this if true?";  // no
            
            while ( have_rows('blocks', $post) ) : the_row(); 
    
             echo "Is this while run?"; // apparently not
     
             if( get_row_layout() === 'my_block' )  {
    
              // is false - my layout has disappeared 
    
    [...]
    
  • Unread

    Duplicate field group with same GraphQL name

    Hello, I have a field group within which I need some fields that conditionally display based on a specific value of a taxonomy on my post.

    I believe that is not possible, and so I have created a new field group which clones many fields from my first group, and adds the additional ones required for my specific taxonomy. I can then conditionally display either my original field group, or my new ‘mostly cloned’ one if the specific taxonomy is chosen.

    The problem is that I want to query one single field group name rather than having to duplicate my GraphQL. So that instead of having to query

    group {
     A
     B
     C
     D

    }
    
mostlyClonedGroup {
     A
     C
     D
     E
     F

    }

    

I can just query

    

group {
     A

     B
     C
     D
     E
     F
    }



    I have given the groups the same GraphQL Type Name but it will not allow me to access the new fields. So is this possible? If it isn’t, is there a better way to achieve the same thing? Thank you.

  • Unread

    Get an ACF field with a Block from another Post

    There was a question about this back in 2019 but the answers there were unsatisfactory although they offered pointers.

    So…

    If you want to output a field within an acf block on another post;

    (warning, it’s a bit buried)

    
    
    function extract_acf_field( $post_id, $block_name, $field ) {
    
        $post_content = get_post( $post_id );
        $blocks =  parse_blocks( $post_content->post_content );
    
        foreach ($blocks as $block) {
        
            if ( $block_name === $block['blockName'])  {
              foreach ($block['attrs'] as $attr) {
                if (is_array($attr)) {
                    foreach ($attr as $key => $value) {
                        if ($field === $key) {
                            return $value;
                        }
                    }
                }
              }
            }
        }
    }
    
  • Unread

    Add tabs and repeaters to an existing field group with PHP

    Hello,

    I know there’s a similar question here but unfortunately it doesn’t seem to answer my question. Any help greatly appreciated…

    I have a field group on an options page which is registered using the acf_add_local_field_group function and the acf/include_fields hook. The field group contains top level tabs for years and ‘within’ the tabs are nested groups that contain more tabs for countries.

    The client can add more countries via a separate repeater field which in turn queries an API and returns data for the country.

    How can I add a new tab for any new countries that are added by the client to my existing field group?

    I’ve tried using acf_add_local_field but it doesn’t seem to work…

    Thanks in advance.

  • Helping

    New post type, but being able to be a child of another post type?

    Hello. I’m hoping someone can help me figure out a way to handle this.

    I have two core post types on a development project I am working. A post type for the sales staff and a post type for the locations (which have a bi-directional relationship with the sales staff to display the staff at a particular location). These post types have very specific field groups utilized for pages within that type.

    The above is already built.

    I am trying to get those post types hierarchical, but accessed through another new post type with options for a parent post for both all the sales posts as well as all the location posts, to utilize the page path used for those post types. I need it to be a separate post type because they need unique post fields that the “parent” post within locations and sales should not include.

    For example:
    domain/sales/sales_person_name/page_specific_to_this_person
    domain/location/name_of_location/an_event_happening_at_this_location

    I want to create an entirely other post type for child pages of both of these. With attributes available, select from all posts from both the sales staff post type as well as the location post type. Alternatively, if that is not possible, can I change the permalink manually to initially post from the root, but also access perhaps the relationship structure of the permalink to a sales or location?

    Is this something achievable?

  • Unread

    Displaying Taxonomy fields on Archive template

    I am using ACF with Oxygen. I have one post type “product” and two taxonomies “store” and “collection”, both taxonomy has multiple custom fields. I have created an archive template, the same template applies to both the taxonomies i.e store and collection. I am using the below php function to return the taxonomy field value. The problem the field value of store is only visible on the stores archive page in the front end. and the field value of collection is only visible on the collection archive page in front end.

    Both the archive page is suppose to display the products, the store name (i.e the store taxonomy custom field), collection name (i.e the collection taxonomy custom field).
    How can i display the store fields on collections page and collection fields on stores page?

    function get_tax_field($field_name) {
    $term = get_queried_object();
    return get_field($field_name, $term);
    }

  • Unread

    acf_form Frontend Gallery Issue

    Hi all, I have custom acf_forms on the frontend and all works great.

    The only issue is the Gallery field. It doesn’t work on mobile at all, nothing can be uploaded and intermittently the “upload files” is not clickable. It seems to work fine on desktop.

    I’ve added the following to the head of the template

    acf_form_head();
    get_header();
    wp_enqueue_media();

    Forms are being used like so:

    <?php acf_form(array(
           'post_id'       => $post_id,
           'field_groups' => array('group_6777be4ea7f06'),
            'updated_message' => __('Updated'),
            'submit_value'  => __('Save'),
        ));
        ?>

    I’ve also tried 'uploader' => 'basic',

    No errors in the console or the log file. I’m a little stumped!

  • Helping

    Proper Related Posts

    Hi! For a client of mine, I am trying to implement a Related Posts functionality using ACF. With the Relationship field, the client can select which posts are related to the post they’re editing, and by using the bidirectionality setting, said related posts link back to the initial post. However, for proper related posts functionality, it would of course make sense if all related posts would then automatically be linked to all other related posts within the same scope.

    For example, if I edit the post with ID 1, and select posts 2, 3, and 4 as related posts, post 2 automatically has post 1 as a related post. However, it should also be linked to posts 3 and 4, without needing to edit post 2 manually.

    Is this something that can be achieved with ACF? Does my question even maken sense? 😅

    Thanks in advance!

  • Unread

    Creating a table from ACF repeater data

    If you’re looking to use an ACF repeater to create an HTML table, here’s how I do it. The ACF function get_field_objects() is used in the post or page template in this case. Dump it out to see what’s in there.

    
    <?php $table = get_field_objects(); ?>
    <table class="table">
    	<thead>
    		<tr>
    			<th>First</th>
    			<th>Last</th>
    			<th>Phone</th>
    			<th>Email</th>
    			<th>Address</th>
    			<th>Joined</th>
    		</tr>
    	</thead>
    	<tbody>
    		<?php foreach ($table['directory_table']['value'] as $row) : ?>
    			<tr>
    				<td><?= $row['first'] ?></td>
    				<td><?= $row['last'] ?></td>
    				<td><?= $row['phone'] ?></td>
    				<td><?= $row['email'] ?></td>
    				<td><?= $row['address'] ?></td>
    				<td><?= $row['joined'] ?></td>
    			</tr>
    		<?php endforeach ?>
    	</tbody>
    </table>
    
  • Unread

    Field condition based on relationship field

    Hi,

    Student post type that has the following fields:
    1. School = Relationship field with the School post type
    2. Architecture Work Description = TextArea field

    I’m hoping to display the Architecture Work Description field conditionally only when the selected School relationship is equal to ‘Architecture’. When I try to set this up, I can’t seem to enter anything in the condition’s value field (screenshot attached).

    Appreciate any advice.

    Thanks!

  • Unread

    Modify Date Picker field to allow typed-in values?

    The company I work with has many clients who enter dates alllll day. Sometimes it would be just quicker for them to enter “01/23/1945” than it would be to click on the year field and scroll to 1945, then click on the month field and scroll to January and then finally click on the 23rd. Is there a simple way to modify the code to allow a user to just type in the date?

    Thanks!

  • Unread

    Ensuring Fields & CPTs are Only Accessible via API with Auth

    I just started using ACF Fields with a headless WordPress setup, and I’m wondering how I can ensure that data within a custom post type and its field groups are only accessible via the WordPress REST API or GraphQL API with authorization. Is this even possible?

    For example, let’s say I create a custom post type to store potential user data for my website, named MyUsers, with fields for username and password.

    I plan to use ACF fields primarily as a database rather than displaying them anywhere on my WordPress site. I don’t want this custom post type and its data to be exposed anywhere on the frontend, should be only accessible when queried on the server side and then sent to my own frontend.

    So, how can I guarantee that this data remains private and accessible only via authenticated API requests? What’s the best way to achieve this?

  • Unread

    Gallery Field image details side panel. Add 3rd party taxonomy picker?

    Hi, I am using a standard Gallery ACF field along with the Media Library Assistant plugin. Images uploaded to this gallery field have an associated taxonomy (Image Tags). To make life easier for the site’s admins who will be uploading lots of images and selecting lots of tags I was hoping I could add the Media Library Assistant’s taxonomy picker to the Gallery side panel.

    At the moment once images have been bulk uploaded to a gallery a user has to click the Add to Gallery button again to open the Add Image to Gallery modal. Here on the right panel you can see the MLA plugin’s taxonomy list. But this isn’t a great user experience as it requires an extra click and the selected images in the modal are greyed out.

    I know it’s possible from within ACF to create a Taxonomy field group and to select the location as [Attachment = All], but the experience isn’t as good as when using the MLA plugin. There’s no ability to add a comma separated list of new tags (there could be tens per image), nor swap between All Image Tags and Most Used.

    So I was wondering if there were any hooks available to inject content into the gallery’s side panel, or any other type of solution I could use to try to get the side panel to display the MLA tag selector?

    Thanks in advance.

  • Solving

    General Isssue

    Here’s a Twitter (X) thread for an **iOS App Development Agency** issue:

    **🚨 Facing Issues with Your iOS App Development Agency? Let’s Talk! 🛠️📱**

    1/ Choosing the right **iOS app development agency** can be tricky. If you’re dealing with delays, bugs, or unmet expectations, you’re not alone! Here’s what to watch out for. 🧵👇

    2/ **Missed Deadlines? ⏳**
    Frequent delays could mean poor project management or a lack of resources. Set clear milestones and request regular updates!

    3/ **Low-Quality Code? 🛠️**
    If your app crashes, loads slowly, or has security flaws, insist on **code reviews & testing**. A great agency prioritizes performance and security.

    4/ **Poor Communication? 📞**
    Lack of updates or unclear explanations? Demand transparency! A reliable agency keeps you in the loop with regular progress reports.

    5/ **Overpromising, Underdelivering? 🎭**
    If the agency promised the world but delivered a subpar app, reconsider your contract. Always check **previous projects & client reviews** before hiring!

    6/ **No Post-Launch Support? 🚀**
    A great agency provides ongoing maintenance and updates. If they disappear after launch, you might need a **better partner**.

    7/ **How to Fix This? ✅**
    – Set clear goals & timelines
    – Demand regular progress updates
    – Review code quality & testing
    – Ensure post-launch support is included

    8/ Facing any of these issues? It’s time to **reevaluate your agency** and find a trusted iOS app development partner. 💡

    9/ Need expert help? **DM us**—we specialize in **high-quality iOS app development** and ensure smooth, transparent collaboration! 🚀📱

  • Unread

    Checkbox save custom with local json

    According to the documentation:

    If using the local JSON feature, any custom values saved to the field’s choices will not appear on page reload. This is because the JSON file will not be updated and will override any field settings found in the database.

    so how do I have a checkbox field that can have a custom value that’s saveable, and still use local json? Or can I turn off local json just for this file?

  • Helping

    Get_Field for Taxonomy Returns Error, ID, or Nothing

    Background: I’m using the classic editor and have disabled Gutenberg blocks and global styles.

    I’ve created a custom post type named Resources, for which I’ve also created an archive archive-resources.php.

    I’ve created a Taxonomy Custom Field labeled Resource Type (name: res_type), which is linked to Resources and has a Radio Button appearance.

    I’ve created a Taxonomy for my custom post type and custom field labeled Materials (the three options for materials are “Book,” “Course,” and “eBook”).

    In my archive file, I’ve started the loop (if “…”, etc.), and in the loop, I am trying to display which Material was selected from the Taxonomy Custom Field in the Resource that was created.

    Initially, I was trying to use the following code:

    $res_type = get_field('res_type'); 
    
    if ($res_type) {
    
    echo '<h4 class="open-sans-lite resource-subtitle smaller-text">'.esc_html($res_type).'</h4>';
    }
    

    This code doesn’t work because if my Taxonomy Custom Field “Return Value” is set to ID, it only returns a number, and if it’s set to Object, it returns an error (please see images attached).

    Instead, I tried this code:

    $res_type = get_field('res_type'); 
    
    if ($res_type) {
    
    echo '<h4 class="open-sans-lite resource-subtitle smaller-text">'.esc_html($res_type->name).'</h4>';
    }
    

    However, this resulted in nothing at all in my HTML, not even an empty H4 element.

    I’ve also been trying get_field_object() to no avail.

    Please help me understand how to retrieve the “Book,” “eBook,” or “Course” taxonomy that’s selected for their respective Resource when I target the Taxonomy Custom Field in the loop.

  • Unread

    ACF ‘wrapper attribute’ changes not appearing

    So question. I have a ACF Field Group that I am using a repeater in as an accordion for an FAQ section. Each item has a header (text), sub header (text) and content section (WYSIWYG Editor). In the ACF editor for the ‘header – presentation’, I added a new class ‘smaller-h5’, and added it to the ‘Wrapper Attributes’ section… which all seems to work fine. See the two screenshots.

    Issue is, the class doesn’t seem to be appearing on the page ‘header’ section.

    <h5 class=”acf-element acf-element-heading [it should appear here]”>XXXX</h5>

    I did republish the page after I made the ACF changes, so upon the republish it should have grabbed the latest ACF changes… but it didn’t seem to. Cache is not an issue either.

    Is there something I have to do to publish ACF field group data? I am fairly new to ACF! Thanks for the info!

  • Unread

    CPT Posts lost & how to prevent?

    Hi there,
    Yesterday, trying to change my permalinks using taxonomies, things went sideways quickly! I learned a tough lesson: I can’t just change the URL slug of a CPT nor can I change the Taxonomy Key. I did both 🙁

    So now all my CPT archive pages and posts went 404 but the CPT posts (except for one CPT) are still there!!! That’s months of work I’m seeing in trouble and I’m super scared now that I do something to make it worse
    I’m a simple website developer, already proud that I even got this far.

    The website I’m working on is in staging. Another lesson learned, the usual backup doesn’t apply to the staging website so I lost all posts in this one CPT.
    I assume they are lost forever, but I am desperate to know how I can protect my posts besides the usual backup.

    Can I export the CPT posts and save them somewhere for them to import again in case a taxonomy breaks for whatever reason? Just to prevent days of work being lost :'(

    Also, any advice on how to back up a staging website?

    If anyone could help this damsel in stress, I would be very grateful.
    Thanks ina advance,
    Femke

  • Solved

    Block Bindng API issue

    I’m attempting to use the Block Binding API with WP 6.7 and ACF Pro 6.3.12.
    I have CPT, Case Study, with an ACF text field, the_challenge. I want that fields value to be the content of a paragraph block on the case study card inside the query loop block.

    
    <!-- wp:paragraph {"align":"center","metadata":{"bindings":{"content":{"source":"acf/field","args":{"key":"the_challenge"}}}},"fontSize":"label-small"} -->
    <p class="has-text-align-center has-label-small-font-size">This will display the challenge on the front end.</p>
    <!-- /wp:paragraph -->
    

    The above looks very promising in the editor. (See screenshot)

    But in the front end, no content is rendered, just and empty paragraph tag.

    I’m a little stuck on how to proceed with debugging from this point. I’ve tried other fields. I’ve tried in the single content rather than inside a query loop.

  • Solving

    Trusted Laundry & Dry-Cleaning Services | Upsoak Expert Care

    Get top-quality laundry & dry-cleaning services with Upsoak. Enjoy fresh clothes, quick delivery, and eco-friendly cleaning services right to your door today.

  • Helping

    Get galleries in repeater from Gutenberg Block

    Hi,

    I’m working on my personal portfolio site, and for the individual project pages I want to be able to create a flexible number of galleries in a repeater, that I can then add one by one to the page with help of Gutenberg blocks.

    I have the fields added and the block all set up, but for some reason I can just not manage to get the galleries.

    This is what I have so far, based on an old example found on the forum:

    <!-- CHECK OUT REPEATER "project_galleries" -->
    <?php if( have_rows('project_galleries') ): ?>
    
    <!-- CHECK TO SEE IF IT HAS ROWS IN IT -->
    <?php while ( have_rows('project_galleries') ) : the_row(); ?>
    
      <!-- DISPLAY THE TEXT-FIELD THEN ASSIGN OUR GALLERY TO VARIABLE $images -->
      <?php
    
      $images = get_sub_field('project_gallery'); 
    
      if( $images ):?>
    	 <?php foreach( $images as $image ): ?>
    	<a href="<?php echo $image['url']; ?>">
    	   <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
    		</a>
    		<p><?php echo $image['caption']; ?></p>
    	 <?php endforeach; ?>
      <?php endif; 
    endwhile;
    else :
    // no rows found
    	echo 'Nothing found'
    endif; ?>

    I would really appreciate any help on this!

  • Solved

    Set field group programatically

    Hi I’m having a bit of a problem with setting the location for a field group in my functions.php file. The code below adds a location of ‘entrant_2025’ only if it doesn’t already exist as a selected location in the location array.

    It works fine. The fields gets added to the custom post type and I can also see it as a selected option in the field group location settings in the ACF UI.

    The problem comes when I save the field group in the UI for whatever reason such as making a change or adding a new field. Each time I click save, another location gets added for ‘entrant_2025’.

    Here is the code:

    add_filter( 'acf/validate_field_group', 'add_custom_location_dynamic', 10, 1 );
    function add_custom_location_dynamic( $field_group ) {
        if ( $field_group['key'] === 'group_6786e0728946a' ) {
            $location = false;
            foreach($field_group["location"] as $loc){
                if(in_array('entrant_2025', $loc[0])){
                    $location = true;
                }
            }
            if(!$location){
                $field_group['location'][][0] = array(
                    'param'    => 'post_type',
                    'operator' => '==',
                    'value'    => 'entrant_2025',
                );
            }
                
        }
        return ($field_group);
    }

    I dont know for sure what is happening but I presume ACF doesn’t see or recognise my saved location and so adds the location again and again and again each time I save.

    I’ve tried changing the priority of 10 to much higher to see if that helps to run the code after acf has run it’s own or way lower to see if ACF will recognise the saved location and therefore not save another one but nothing works.

    Any pointers would be a great help. Thanks.

  • Solved

    acf/load_value return no $value

    Hi, I have a select field which is empty and I want to fill it with acf/load_value.
    I used the following code, but the select field is empty.
    If I insert something into the select field via the dashboard in ACF, it is displayed in the dashboard, but the $value is also empty.

    
    add_filter('acf/load_value/key=field_67878669b82ab', 'loadStartLocation', 10 , 3);
    function loadStartLocation( $value, $post_id, $field ) {
    	$value = array('Hamburg', 'Bremen'); 
        return $value;
    }
    


    array(
    'key' => 'field_67878669b82ab',
    'label' => 'Startort',
    'name' => 'product_ballon_start_location',
    'aria-label' => '',
    'type' => 'select',
    'instructions' => '',
    'required' => 0,
    'conditional_logic' => 0,
    'wrapper' => array(
    'width' => '',
    'class' => '',
    'id' => '',
    ),
    'choices' => array(
    'cool' => 'cool',
    ),
    'default_value' => false,
    'return_format' => 'value',
    'multiple' => 0,
    'allow_null' => 0,
    'allow_in_bindings' => 0,
    'ui' => 0,
    'ajax' => 0,
    'placeholder' => '',
    ),

Viewing 25 results - 51 through 75 (of 21,345 total)