How to get path or root of plugin folder, not file or dir?

How about just define a constant that stores the plugin’s root path? Define path constant For calling numerous files, it is sometimes convenient to define a constant: define( ‘MY_PLUGIN_PATH’, plugin_dir_path( __FILE__ ) ); include( MY_PLUGIN_PATH . ‘includes/admin-page.php’); include( MY_PLUGIN_PATH . ‘includes/classes.php’); // etc. — See https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-491 So in your main plugin file: define( ‘MY_PLUGIN_PATH’, plugin_dir_path( … Read more

Form that generates an ID for the customer

WordPress doesn’t provide contact forms by default. So either you’ll have to use a form plugin or you’ll need custom CODE anyway. Since you didn’t provide any CODE or reference to any plugin you’re going to use, I cannot provide a sample CODE that’ll work for you. In principle, plugins do provide custom hooks that … Read more

Determining when was the last time a plugin was activated

It looks like, in a Multisite installation, any network-wide plugins record their activation time in a site option. By default, plugins activated in a single site in a Multisite network (or in a single-site installation) do not. See the source of the activate_plugin() function. You could write a simple plugin that records that information, using … Read more

What exactly happens to function argument availability when using a filter?

The important thing to note is that action and filter hooks are mostly just standard PHP callback behaviour. The second argument passed to add_filter() should be a PHP Callable. When the filter is applied with apply_filters(), that callback is just run through the core PHP function call_user_func_array(). Any additional arguments to apply_filters() are then passed … Read more

Plugins ignored a line breaks or tag in the WordPress comment functions

On orbisius-support-tickets/modules/core/cpt.php file the comment is sanitised as a single-line input with the function sanitize_text_field() which removes the line breaks. For a textarea field WordPress has sanitize_textarea_field(); Ref: https://developer.wordpress.org/reference/functions/sanitize_textarea_field/ On that file, you can find the line $comment = sanitize_text_field( wp_strip_all_tags( $_POST[‘comment’] ) ); And replace it with: $comment = sanitize_textarea_field( wp_strip_all_tags( $_POST[‘comment’] ) );