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

Fatal error: Uncaught Error: Call to undefined function get_option()

Instead of doing this, simply write your own function inside the verifyapi.php and then include it in your plugin’s main file, by using this: require_once(‘verifyapi.php’); This way, you have access to WordPress’s function inside your verifyapi.php file. Now, inside your verifyapi.php file, create an Ajax handler (however I would recommend using a REST endpoint) : … Read more

Plugin directory says that my plugin it’s not availabe in Spanish, but it is

To be able to approve your own plugin translations you have to post in the Polyglots site: https://make.wordpress.org/polyglots/ a message like this: “Hello, I’m the author of the {insert plugin name and a link} plugin. Could you allow me to approve translations in my native language (es_ES), please?” And select “Editor Request” in the “Post … Read more

How can I replace content in the WP Admin area before an admin page is rendered?

There’s no filter for filtering all of the HTML output in the admin. The closest thing is the gettext filter: function wpse_275812_filter_text( $translated_text, $text, $domain ) { $translate_text = str_ireplace( ‘foo’, ‘bar’, $translated_text ); return $translated_text; } add_filter( ‘gettext’, ‘wpse_275812_filter_text’ ); This filters any text output by the internationalization functions (__(), _e(), etc.). So it … 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

I want to add custom add to cart link [closed]

Your problem is that get_page_by_path() returns a WP_Post object, not a WC_Product object. You need a WC_Product object, because that’s the object that contains the product_type property. You can get a WC_Product from a WP_Post via the wc_get_product() function: $post_obj = get_page_by_path( $slug, OBJECT, ‘product’ ); // this code help me to get product detials … 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