wp_editor add media button not working

I will assume that you are creating a custom admin page at ?page=add-quiz, in this case before calling the wp_editor function you also have to enqueue the CSS / Js files for it with the wp_enqueue_media() function. So at the end you should have wp_enqueue_media(); wp_editor( ”, ‘instructions’, $settings = array(‘textarea_name’ => ‘instructions’, ‘textarea_rows’ => … Read more

WP and object persistence (or lack thereof)

PHP is inherently designed as non–persistent language, every request starts from no state and builds up from there. WP mostly follows this, with every request performing core boot and proceeding to process context from GET/POST request (and possibly user cookie). The typical mechanisms for persistence in WP are: database (posts / metas / options) object … Read more

admin_post equivalent for guest user?

If you look at admin-post.php, there is a check for wp_validate_auth_cookie() not whether the user is an administrator. So anyone with a valid authorization cookie will trigger the “admin_post_{$action}” hook. If the user doesn’t have a valid authorization cookie, then WP will trigger “admin_post_nopriv_{$action}”.

Can’t change the style of a submit input type? [closed]

The fault is from the following code, change the colors or remove it. .xoouserultra-wrap a.xoouserultra-button:hover, input[type=submit].xoouserultra-button:hover, input[type=submit].xoouserultra-button:focus, input[type=button].xoouserultra-button:hover, input[type=button].xoouserultra-button:focus, .xoouserultra-wrap a.xoouserultra-button:active, input[type=submit].xoouserultra-button:active, input[type=submit].xoouserultra-button:active, input[type=button].xoouserultra-button:active, input[type=button].xoouserultra-button:active { border: 1px solid #1278b2; background-color: #1278b2; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1278b2), to(#1391da)); background-image: -webkit-linear-gradient(top, #1278b2, #1391da); background-image: -moz-linear-gradient(top, #1278b2, #1391da); background-image: -ms-linear-gradient(top, #1278b2, #1391da); background-image: -o-linear-gradient(top, #1278b2, … Read more

How to Control CSS of Admin On Creating only a Specific Custom Post Type

You can use this code: add_action( ‘admin_enqueue_scripts’, ‘load_admin_style’ ); function load_admin_style() { global $pagenow; if ( ‘post.php’ === $pagenow && isset($_GET[‘post’]) && ‘YOURPOSTTYPE’ === get_post_type( $_GET[‘post’] ) ) { wp_enqueue_style( ‘admin_css’, get_template_directory_uri() . ‘/admin-style.css’, false, ‘1.0.0’ ); } }

Is it necessary to do validation again when retrieving data from database?

The short answer is “yes”, the longer answer is “it depends”. Why do you need to validate? because if you have code, which if used with wrong parameters will delete wordpress (very bad example I know), you should made double sure that it is not triggered by some DB corruption, or more likely, misbehaving filter. … Read more