ACF Table Field Pro Add-on Docs

Select plugin version:

Since version: v1.4.0

GraphQL

The table field can be read and updated with GraphQL.

Get table data of a page

query GetPage { 
	page(id: "123", idType: DATABASE_ID) { 
		yourFieldGroup { 
			tableFieldName 
		} 
	} 
}

Gets the table data of a page with post ID "123" from fieldgroup "yourFieldGroup" with field name "table_field_name". Note that field names written with underscores must be queried as camelcase in GraphQL.

{ 
	"data": { 
		"page": { 
			"tableFieldGroup": { 
				"tableFieldName": "{"t":{"o":{"ct":"st","cols":1,"rows":1,"uf":"n","uh":"n","tb":"","changed":true}},"c":[{"c":[{"c":"","o":[]}],"o":[]}],"b":[{"c":[{"c":"Hello Table","o":[]}],"o":[]}],"f":[{"c":[{"c":"","o":[]}],"o":[]}],"h":[{"c":[{"c":"","o":[]}],"o":[]}],"p":{"v":"1.2.10","fk":"field_664dcdcdd4983","fn":"table_field_name"}}" 
			} 
		} 
	} 
}

The return is a JSON representation of the table fields raw data. To get the table HTML, you can pass the JSON string to get_table() or use the table_manager() to edit the table and also output it as HTML.

Update table data of a page

mutation MyMutation { 
	updateTablefieldPro( 
		input: {postID: "123", selector: "tableFieldName", tableJSON: "{"t":{"o":{"ct":"st","cols":1,"rows":1,"uf":"n","uh":"n","tb":"","changed":true}},"c":[{"c":[{"c":"","o":[]}],"o":[]}],"b":[{"c":[{"c":"Hello Table","o":[]}],"o":[]}],"f":[{"c":[{"c":"","o":[]}],"o":[]}],"h":[{"c":[{"c":"","o":[]}],"o":[]}],"p":{"v":"1.2.10","fk":"field_664dcdcdd4983","fn":"table_field_name"}}", clientMutationId: "update_table"} 
	) { 
		clientMutationId 
		postID 
		return 
	} 
}

Updates the table data of a page with post ID "123" with field name "table_field_name". Note that field names written with underscores must be queried as camelcase in GraphQL.

{ 
	"data": { 
		"updateTablefieldPro": { 
			"clientMutationId": "update_table", 
			"postID": "123", 
			"return": "true", 
		} 
	} 
}

return returns the update_field() return value.

Previous and Next Sources

Parent sources