Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested page link field returning null #198

Open
2 of 3 tasks
tablufc88 opened this issue Apr 19, 2024 · 5 comments
Open
2 of 3 tasks

Nested page link field returning null #198

tablufc88 opened this issue Apr 19, 2024 · 5 comments
Assignees
Labels
status: actionable Ready for work to begin type: bug Issue that causes incorrect or unexpected behavior

Comments

@tablufc88
Copy link

Description

I have a flexible content field where I'm creating galleries and adding a "page_link" field to choose multiple pages for the gallery to be shown on. Since upgrading from wp-graphql-acf to wpgraphql-acf, it is always returning null rather than an array of page links.

Steps to reproduce

Possibly related to this

  1. Create options page for galleries:
[
            'page_title' => 'Galleries',
            'menu_title' => 'Galleries',
            'menu_slug' => 'galleries',
            'capability' => 'edit_posts',
            'redirect' => false,
            'position' => 2,
            'icon_url' => 'dashicons-format-gallery',
            'show_in_graphql' => true,
]
  1. Import the field group json file

  2. Populate some content

  3. Query the field:

query galleryShowOns {
    galleries {
      galleries2 {
        galleries {
          ... on Galleries2GalleriesGalleryLayout {
            title
            showOn {
              edges {
                node {
                  id
                  uri
                }
              }
            }
          }
        }
      }
    }
  }

PHP or JSON export of the ACF Field Group(s)

{
    "key": "group_63ff34a068856",
    "title": "Galleries",
    "fields": [
        {
            "key": "field_63ff34c95bfc2",
            "label": "Galleries",
            "name": "galleries",
            "aria-label": "",
            "type": "flexible_content",
            "instructions": "Manage all the website galleries here. Enter a title for each gallery and remember to choose which pages to show the gallery on.",
            "required": 0,
            "conditional_logic": 0,
            "wrapper": {
                "width": "",
                "class": "",
                "id": ""
            },
            "show_in_graphql": 1,
            "layouts": {
                "layout_63ff34da33bd4": {
                    "key": "layout_63ff34da33bd4",
                    "name": "gallery",
                    "label": "Gallery",
                    "display": "block",
                    "sub_fields": [
                        {
                            "key": "field_63ff34e85bfc3",
                            "label": "Title",
                            "name": "title",
                            "aria-label": "",
                            "type": "text",
                            "instructions": "",
                            "required": 0,
                            "conditional_logic": 0,
                            "wrapper": {
                                "width": "",
                                "class": "",
                                "id": ""
                            },
                            "show_in_graphql": 1,
                            "default_value": "",
                            "placeholder": "",
                            "prepend": "",
                            "append": "",
                            "maxlength": ""
                        },
                        {
                            "key": "field_63fffccdd9b0b",
                            "label": "Show on",
                            "name": "show_on",
                            "aria-label": "",
                            "type": "page_link",
                            "instructions": "Choose which pages to show this gallery on",
                            "required": 0,
                            "conditional_logic": 0,
                            "wrapper": {
                                "width": "",
                                "class": "",
                                "id": ""
                            },
                            "post_type": [
                                "page"
                            ],
                            "post_status": "",
                            "taxonomy": "",
                            "allow_archives": 1,
                            "multiple": 1,
                            "allow_null": 0,
                            "show_in_graphql": 1,
                            "graphql_description": "",
                            "graphql_field_name": "showOn",
                            "graphql_connection_type": "one_to_many"
                        },
                        {
                            "key": "field_63ff35025bfc4",
                            "label": "Images",
                            "name": "images",
                            "aria-label": "",
                            "type": "gallery",
                            "instructions": "",
                            "required": 0,
                            "conditional_logic": 0,
                            "wrapper": {
                                "width": "",
                                "class": "",
                                "id": ""
                            },
                            "show_in_graphql": 1,
                            "return_format": "array",
                            "preview_size": "medium",
                            "insert": "append",
                            "library": "all",
                            "min": "",
                            "max": "",
                            "min_width": "",
                            "min_height": "",
                            "min_size": "",
                            "max_width": "",
                            "max_height": "",
                            "max_size": "",
                            "mime_types": ""
                        }
                    ],
                    "min": "",
                    "max": ""
                }
            },
            "button_label": "Add gallery",
            "min": "",
            "max": ""
        }
    ],
    "location": [
        [
            {
                "param": "options_page",
                "operator": "==",
                "value": "galleries"
            }
        ]
    ],
    "menu_order": 0,
    "position": "normal",
    "style": "default",
    "label_placement": "top",
    "instruction_placement": "label",
    "hide_on_screen": "",
    "active": true,
    "description": "",
    "show_in_rest": 0,
    "show_in_graphql": 1,
    "graphql_field_name": "galleries2",
    "map_graphql_types_from_location_rules": 0,
    "graphql_types": "",
    "modified": 1713487960
}

Additional context

No response

WPGraphQL Version

1.23.0

WPGraphQL For ACF Version

2.2.0

ACF (Advanced Custom Fields) Version. Free or Pro?

Pro

WordPress Version

6.5.2

PHP Version

8.1.27

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
@josephfusco josephfusco added the needs: reproduction This issue needs to be reproduced independently label Apr 22, 2024
@marcwieland95
Copy link

marcwieland95 commented May 30, 2024

I can confirm this issue with very similar versions.

Repeater field with a link field inside on an option page.

@mckelvey
Copy link

mckelvey commented Jun 1, 2024

I was working through the upgrade guide on a very spare site (mostly just ACF Pro 6.3.0.1, wpgql 1.26.0 and wpgql-acf at 2.2.0 on wp 6.5.3) and found a very similar thing; for a simple repeater, each a single image, attached via the options page (no post_id in the setup) I get the correct number of nodes (8 images in the repeater) under the correct/expected GQL structure, but all as null.

I’ve reverted back to 0.6.1 for now.

@gnathang
Copy link

gnathang commented Jun 3, 2024

I have also had this problem, and found that the issue extends to both the File and Post Object field types. The file returns null, while the edges and node arrays inside the Post Object return empty.

@josephfusco josephfusco removed the needs: reproduction This issue needs to be reproduced independently label Jun 6, 2024
@josephfusco josephfusco added type: bug Issue that causes incorrect or unexpected behavior status: actionable Ready for work to begin labels Jun 6, 2024
@cavemon
Copy link

cavemon commented Aug 30, 2024

+1

@gridig
Copy link

gridig commented Sep 3, 2024

Same issue here, page_link within a repeater filed returns null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: actionable Ready for work to begin type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

No branches or pull requests

8 participants