Using a PHP function in Query Args in Builder?

Support MB Builder Using a PHP function in Query Args in Builder?Resolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31191
    JohnJohn
    Participant

    Hi,

    I'm trying to filter a taxonomy in builder to only display taxonomies with a certain value.

    If I type it in manually, it works fine, ie

    Query Args with a key of slug and a value of test, shows me the taxonomy with the slug called test.

    Is there a way to run a PHP function in the value? ie, one that runs echo "test"; in this case ?

    I was going to generate the PHP code and do it there, but when I press Generate PHP Code it just hangs forever. There are no errors in the php logs.

    Any advice please?

    Thanks
    John

    #31196
    Long NguyenLong Nguyen
    Moderator

    Hi John,

    The option Query args in the Builder does not support passing a callback function. You will need to use the PHP code to assign a PHP function to an argument.

    Please follow the sample code here https://docs.metabox.io/fields/taxonomy/#limit-the-number-of-terms-for-pagination

    #31197
    JohnJohn
    Participant

    Ah ok, thanks. Any idea why the PHP Generation is hanging please?

    #31213
    Long NguyenLong Nguyen
    Moderator

    Hi John,

    Please open the Console tab of the Inspect tool and check if there is an error message. Get more details on the Debugging Information step here https://support.metabox.io/topic/how-to-create-a-new-topic/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.