Admin ajax request return 0 with die()
Add this as well: add_action(‘wp_ajax_nopriv_my_action’, ‘my_action_callback’);. Notice the nopriv. It will solve your problem!
Add this as well: add_action(‘wp_ajax_nopriv_my_action’, ‘my_action_callback’);. Notice the nopriv. It will solve your problem!
https://github.com/scribu/wp-scb-framework/wiki This guy has built what you are looking for I believe. He’s a core-contributor and his code is top notch. And the project is open on github, so even better right?
Easy enough, decided to just do the redirect option. I used the wp_login action hook. You could also probably use this for redirecting your users to ANY page on your website. You can also check user capabilities from the $user Object passed in as a function parameter if you want to send different user levels … Read more
If you upgrade your WordPress to 3.3.1, which you absolutely should, each widget area in the admin now has an ID you can use to target via CSS, which really should be enough. See http://core.trac.wordpress.org/ticket/18334 for an example.
According to this test, you use set_current_screen() to navigate to one of these in the setUp method. Alas, none of this is apparent if you look at the tremendously-helpful reference page for get_current_screen()… Example: <?php class AxisSetupTest extends WP_UnitTestCase { /** * @covers AxisWP::__construct */ function test_constructor() { // Assert // Admin $this->assertInternalType(‘integer’, has_action( ‘admin_enqueue_scripts’, … Read more
No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg: add_menu_page ( ‘Test Menu’, ‘Test Menu’, ‘read’, ‘testmainmenu’, ”, ” ); add_submenu_page ( ‘testmainmenu’, ‘Test Menu’, ‘Child1’, ‘read’, ‘child1’, ”); The first parameter of … Read more
A GROUP BY statement can group your posts after the JOIN. For WordPress you can use the posts_groupby filter. add_filter( ‘posts_groupby’, ‘my_post_limits’ ); function my_post_limits($groupby) { global $pagenow, $wpdb; if ( is_admin() && $pagenow == ‘edit.php’ && $_GET[‘post_type’]==’listings’ && $_GET[‘s’] != ” ) { $groupby = “$wpdb->posts.ID”; } return $groupby; }
There is a constant you can define in wp-config.php to do this. It will also disable the theme edit, however. <?php // somewhere in wp-config.php define(‘DISALLOW_FILE_MODS’, true); That will remove the plugin and theme file editor (which are a terrible idea anyway) and remove the ability to install plugins and themes from the admin area.
UPDATE 2018-06-28 While the code below mostly works fine, here is a rewrite of the code for WP >=4.6.0 (using PHP 7): function add_course_section_filter( $which ) { // create sprintf templates for <select> and <option>s $st=”<select name=”course_section_%s” style=”float:none;”><option value=””>%s</option>%s</select>”; $ot=”<option value=”%s” %s>Section %s</option>”; // determine which filter button was clicked, if any and set section … Read more
As you’ve already discovered, links to the customizer always start with /wp-admin/customize.php. Append ?autofocus[section] =section_name to checkout your section within the customizer. Both parameters (section and section_name) are registered within your customize_register hook: $wp_customize->add_section If you can’t find the hook, check the HTML markup of the customizer for further information. Both parameters are included within … Read more