Developer API troubleshooting
4 min read
First step for any problem: turn on WP_DEBUG and look at WPM Fields › Settings › Health. Bad object arguments and refused values raise _doing_it_wrong() notices, and runtime failures are logged there instead of breaking the page.
wpmcf_get_field() returns null or the default
Check | Fix |
|---|---|
Wrong keys | Use the Key of the group and field from the builder (not labels). Keys are lower-cased. |
Field is inside a Group or Repeater | Read the top-level field and add |
No current post | Outside the loop pass an ID: |
User, term or comment | Pass |
Group is not attached to that object type | Check the group's location rules. |
Plain numeric ID for a user | A bare |
| An explicit |
Value was never saved | The default is returned for |
Values from an import/other plugin | If written to post meta they are not in the table. See the meta bridge in Field groups. |
wpmcf_the_field() prints nothing
- The value is empty (nothing is ever printed for empty values).
- It is a Password field (never printed). See Password helpers and security.
- A Group, or any array with
formatother thanauto: use apath, orautofor Repeaters. - The object reference is invalid (a notice appears under
WP_DEBUG).
wpmcf_update_field() returns false
Cause | Check |
|---|---|
Unknown group or field key | Typos; the field must be top-level and have a column (not a Tab or Accordion). |
Object does not exist | The post, user, term or comment ID is wrong. |
Invalid reference | See Object references. |
The field type refused the value | A |
Field type not available | A Pro type without an active license cannot be written. |
Database error | Look in Settings › Health. |
It returns true but the field reads back empty when the type drops values it cannot accept: a select choice that does not exist, an invalid URL, a non-numeric number. Read the value back and compare. See Writing values.
A value is saved but disappears or changes
- Text fields strip HTML tags on save (
<b>is removed); use a Textarea/WYSIWYG field for markup. - A WYSIWYG field removes scripts and unsafe markup.
- The next edit screen save overwrites the values of fields on that screen.
A shortcode prints nothing
See the table in Shortcodes. The most common cause is the visibility rule: private posts, drafts, password-protected posts, other users' fields and options values in a contributor's content are hidden on purpose.
[wpmcf_global] / wpmcf_the_global()
- Expressions and
defaultwork like inwpmcf_get_global(). Older builds printed{{ ... }}literally and ignoreddefault: update the plugin. - Prints nothing for a password variable: by design.
Block shows nothing
See Blocks and Block Bindings. Set a fallback on the WPM Field block to confirm the block renders at all.
wpmcf_query is ignored
Symptom | Cause |
|---|---|
Every post is returned | You used |
No posts at all | An argument is invalid (typo in the reference, unknown operator, group not attached to posts). Enable |
| By design for the main query. Use the |
| Number columns cast to |
Posts without a value missing from | Negations on empty values do not match |
REST requests
Response | Meaning |
|---|---|
No | The group's Show in the REST API is off, or no rule says Post type is equal to that type. |
| Not logged in (or the application password is wrong). |
| The user cannot edit that post (a subscriber, or a contributor on someone else's post). |
| Wrong key, REST off, or the group's location does not match this post. |
| Wrong field key, or the field has no column. |
|
|
| Password-protected posts hide values in the view context. |
Post created although you got | Core inserts the post before the field values are processed. See REST API. |
The wpmcf/v1 routes answer 401 logged out and 403 without manage_options: they are for the admin UI, not for integrations.
Still stuck
Check the item against the function's own page: Reading, Writing, References, Output, Function reference. For hooks and expressions see Variables and hooks.
Still stuck? Contact support