Does WordPress have a “Form API”?

No, but it should 😉 There are several custom field class’s (backend). wpAlchemy : https://github.com/farinspace/wpalchemy Meta Box Script: https://github.com/rilwis/meta-box My-Meta-Box: https://github.com/bainternet/My-Meta-Box meta-box-class: https://github.com/corycrowley/meta-box-class Meta Boxes Class: https://github.com/Bakke/Wordpress-Custom-Meta-Boxes-Class For front-end forms, you probably best off with a plugin in Eugene Manuilov’s link.

Convert output of nav_menu items into a tree-like multidimensional array

The problem of building a tree from a flat array has been solved here with this, slightly modified, recursive solution: /** * Modification of “Build a tree from a flat array in PHP” * * Authors: @DSkinner, @ImmortalFirefly and @SteveEdson * * @link https://stackoverflow.com/a/28429487/2078474 */ function buildTree( array &$elements, $parentId = 0 ) { $branch … Read more

New WP_Customize API – how does it work under the hood?

There’s a few bits here that apply, but the short of it is this code in customize-preview.js: this.body.on( ‘click.preview’, ‘a’, function( event ) { event.preventDefault(); self.send( ‘scroll’, 0 ); self.send( ‘url’, $(this).prop(‘href’) ); }); The event.preventDefault prevents the links from actually working. The following code then sends a message back upwards telling it to a) … Read more

How to pass variable to add_settings_section() callback?

if you look at the do_settings_sections function more specifically the line 1164 where the callback function is being executed : call_user_func($section[‘callback’], $section); you can see that the $section array is being passed to the callback function, so you can identify the callback by the $section[‘id’] hope this make since. Update here is an example, if … Read more

How to store username and password to API in wordpress option DB?

While I agree with the previous answers, to answer the question you actually asked, what comes to mind is to use one of these constants for wp-config.php: define(‘AUTH_KEY’, ‘redacted’); define(‘SECURE_AUTH_KEY’, ‘redacted’); define(‘LOGGED_IN_KEY’, ‘redacted’); define(‘NONCE_KEY’, ‘redacted’); They are meant to be unique across wordpress installations – and are about the only options for pre-existing keys to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)