Adding Attachment Display Settings in custom media frame
Just add frame: ‘post’, to wp.media attributes.
Just add frame: ‘post’, to wp.media attributes.
The form action needs to point to options.php, which is WordPress’ built-in handler for all settings pages: <form method=”POST” action=”options.php”> This is documented fairly thoroughly on the Settings API page of the Codex.
Per comments, an alternative is to use the built-in Firefox debugger instead (Inspect Element (Q)) – it’s very good (now) and is (almost completely) unaffected by the WP heartbeat.
You already have <option value=””>…</option> you just need some extra attrs for it You need to load current value and if value equals $page->ID than add attr selected=”selected” Here’s how it could be done: <select name=”easyreg_redirect_page”> <option selected=”selected” disabled=”disabled” value=””><?php echo esc_attr( __( ‘Select page’ ) ); ?></option> <?php $selected_page = get_option( ‘option_key’ ); $pages … Read more
If you can assume that user profile is edited all at once (Users Role, Organisation ID and Organisation name), you can hook on only one meta_key (say Organisation name) and send all infos at this moment. By the time this action is fired, all 3 metas are already in database. add_action(‘updated_user_meta’, ‘when_user_meta_updated’, 10, 3); function … Read more
If a checkbox is unchecked, it doesn’t get submitted with the form values. So when using checkboxes, you should have an else statement for isset( $_POST[‘iwmp_settings_form_submitted’] ) and it basically will be triggered when the checkbox is unchecked. Here’s the fixed code. //Global Variable $options = array(); //Options Page function iwmp_options_page() { if( ! current_user_can( … Read more
Your problem is that you’re using Reserved Terms. error is a reserved term, you can’t use it. To get around this, you could intercept the request early, and do a redirect, changing the query parameters in the process. For example, handling a link get parameter: add_action( ‘wp’ , ‘reserved_term_intercept’ ); function reserved_term_intercept(){ global $wp_query; if( … Read more
Could somebody explain why it’s advised never to load wp-admin/admin.php in your plugin and how it could cause issues? Because it is loading WordPress out of context– well, parts of WordPress. And that can cause unexpected effects such as functions not being loaded or functions being loaded twice (which will cause fatal errors). You will … Read more
By passing the _builtin argument to get_post_types(), only WordPress default post types will be returned. Instead, just pass public as an arguement, Here’s an example of output on a development site with WooCommerce activated: var_dump(get_post_types([‘public’ => true])); //result array(4) { [“post”]=> string(4) “post” [“page”]=> string(4) “page” [“attachment”]=> string(10) “attachment” [“product”]=> string(7) “product” } With no … Read more
For do this you need to save in the db a value for remember that the alert was already showed. Else you can try to llok on that https://codex.wordpress.org/Function_Reference/register_activation_hook. With this you can execute an hook only on the activate action of the plugin.