Access WP_REST_Server from within plugin namespace

WordPress (version 5.0) doesn’t use namespaces for it’s classes, so try to use the global one: \WP_REST_Server to avoid assuming it’s in your custom namespace. One of the reason for this is that WordPress supports PHP 5.2.4+ that doesn’t support namespaces. The minimum is PHP 5.3.3+, if I remember correctly, to support it. Later this … Read more

How to create multiple database tables on plugin activation?

Why only the second? Because dbDelta() supports CREATE TABLE table_name format only. I.e. Exactly “CREATE TABLE” followed by (one space and) the table name. More specifically, dbDelta() uses this regular expression pattern: CREATE TABLE ([^ ]*) when parsing the queries into an array indexed by the table name; i.e. array( ‘table_1’ => ‘query’, ‘table_2’ => … Read more

changing posts layout in ultimate member profile plugin

Here is some basic CSS which would help make things a grid on Desktop and stacked on Mobile: .um-profile-body.posts.posts-default { max-width: 100%; padding: 0 15px; } @media (min-width: 768px) { .um-profile-body.posts.posts-default { padding: 0; } } .um-ajax-items { display: grid; grid-template-columns: 100fr; grid-template-rows: auto; margin-bottom: 15px; grid-gap: 15px; } @media (min-width: 768px) { .um-ajax-items { … Read more

Plugin Options not being output

Basically, you’re not using the correct option name. In your viptips_settings_init() function, you use the name viptips_settings as the database option name when registering the setting: // The syntax is: register_setting( ‘<settings group name>’, ‘<database option name>’ ) register_setting( ‘pluginPage’, ‘viptips_settings’ ); So WordPress will use that viptips_settings when saving the option (i.e. update_option( ‘viptips_settings’, … Read more

Batch update of WordPress Plugins

You need to also back up the database in addition to the plugins folder. Not only is information stored in the database about which versions of which plugins are installed, an updated plugin itself may make changes to its settings which is stores in the database. Without backing up both the database AND the plugins … Read more

How do I disable an update for a specific plugin?

function AS_disable_plugin_updates( $value ) { //create an array of plugins you want to exclude from updates ( string composed by folder/main_file.php) $pluginsNotUpdatable = [ ‘plugin1/plugin.php’, ‘plugin2/plugin2.php’ ]; if ( isset($value) && is_object($value) ) { foreach ($pluginsNotUpdatable as $plugin) { if ( isset( $value->response[$plugin] ) ) { unset( $value->response[$plugin] ); } } } return $value; } … Read more

What is @Action in WordPress?

This is called php annotations. Many of them are built-in via a standard called phpdoc (like @var), and they are used by the interpreter or the static tools (also by humans for a more structured comment). There is another usecase for these annotations, and it’s to run some code – probably using reflections (which usually … Read more

Know which plugin is calling JS in wp_head()?

Plugins and themes tend to use wp_enqueue_script() to queue up scripts for the <head /> of your theme. I would rarely advise this, but since you only need to do it temporarily, you could modify WordPress core and run a debug backtrace for every call to this function. In wp-includes/functions.wp-scripts.php, drop the following code inside … Read more

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]