How to set add question capability for author role in wp pro quiz plugin

A much more efficient way that doesn’t require editing the source code: install and activate wpfront User role editor, go to all roles, edit the author role, scroll down to the ‘other capabilities’ section, check the following capabilities: wpProQuiz_show, wpProQuiz_add_quiz, wpProQuiz_edit_quiz Save. The authors on your site should now be able to add and edit … Read more

How to retain table data in wordpress phpunit tests

Usually, you don’t want to do this, as it might inadvertently affect tests that run after the test that creates the data. If there is some data that you need to be available to several of your tests in a single testcase, you can create it with wpSetUpBeforeClass(), and then remove it again in wpTearDownAfterClass(). … Read more

Using plugin functions/methods within templates

Premature optimization is the root of all evil (ok, waste of programing time). Why would you care how many times a function is called? it is not like the memory or CPU is getting “weaker” by overusing it. It is more important that the code you produce will be self documenting as much as possible … Read more

Ajax call returning 0

When defining an Ajax handler, you should consider defining both for logged in and non logged in users. You can do so by using: add_action(‘wp_ajax_my_handler’, ‘callback_function’); add_action(‘wp_ajax_nopriv_my_handler’, ‘callback_function’); Now, as for your question. We can turn this code into a REST endpoint, if you are interested, which is faster and easier to set up. Let’s … Read more

How can I make my metabox appear?

I’ve managed to make it work because of @howdy_mcGee’s comment. I did not notice that I had to call the specific post type name of it. my code is now like this and it shows up! function slide_add_post_meta_boxes() { add_meta_box( ‘pukkemukslideshow’, // Unique ID __( ‘Slideshow’, ‘example’ ), // Title ‘slide_post_class_meta_box’, // Callback function ‘slideshow’, … Read more