Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro
Docs

The PHP API

Where the value comes from (the second argument)

Every function takes, as its second argument, where to read from. Without it, it reads from the page or post being shown.

1 minute to read Updated 1 week ago

PHP
ugly_get( 'subtitle' );              // from the page or post being shown
ugly_get( 'subtitle', 42 );          // from the post with ID 42
ugly_get( 'footer_text', 'option' ); // from an options page
ugly_get( 'color', 'term_12' );      // from term 12 (a category, a tag...)
ugly_get( 'phone', 'user_3' );       // from user 3
Second argument Reads from
(nothing) The current post (inside The Loop, or the queried page)
42 The post with that ID
'option' The options pages
'term_12' The term with ID 12, in any taxonomy
'user_3' The user with ID 3

It returns null if the field does not exist for that place.

Inside a block

In the render file of a block, ugly_get() and ugly_show() give the values of that block. See Blocks.

Did this article answer your question?