Restricting users to a specific front end page [closed]

You’d have to add a function during the init action of WP. There you’ll get the current user and check whether they have a specific role assigned to them and redirect to the page when they do. add_action(‘init’, function () { $user = wp_get_current_user(); $role=”your role”; if (in_array($role, $user->roles)) { wp_redirect(‘url’); } }); WordPress Function … Read more

How to add nofollow on all external links without plugin?

This is how I would do it : 1/ create a filter to access the post content before it’s displayed on page. See http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2/ Inside your fonction called (ie : my_the_content_filter in the example from the Codex) adapt this code : https://stackoverflow.com/questions/5037592/how-to-add-rel-nofollow-to-links-with-preg-replace Cheers !

WordPress Post tags (get_the_tags & has_tag)

I actually debugged this and found the problem. It is directly related to creating a post via the REST API. I have found that when a post is created via the REST API that the hook callbacks happen in a different order from a post created with the admin UI. Specifically when the REST API … Read more

Disable plugin on Specific Page of Admin

That’s pretty easy. Remember, I don’t know exactly what’s the plugin’s file name and directory, and the following code was not tested. Put this to the functions.php or create a small plugin. <?php add_filter( ‘option_active_plugins’, ‘wpse264498_deactivate_fat_gallery’ ); function wpse264498_deactivate_fat_gallery($plugins){ // check if you are on the certain page global $pagenow; if( $pagenow == ‘post-new.php’ ) … Read more

Plugin form unable to process

You missed name attribute of <input type=”submit” value=”<?php _e(‘Submit’); ?>”/> HTML tag. i.e. It should be looks like: <input type=”submit” name=”Submit” value=”<?php _e(‘Submit’); ?>”/> Else, You have to change if condition inside function form_processing() OLD: if(isset($_POST[‘Submit’])){ Replace with: if(isset($_POST[‘rollNumber’])){ Hope this will helps you.

Force wordpress to request for FTP Info on theme/plugin install/update

I just tried this on a local install that previously used the ‘direct’ FS_METHOD. In wp-config.php, set the following constants: define(‘FS_METHOD’, ‘ftpext’); Not sure if this actually affects things, but I also set these to try to force the input fields to be empty when the form is presented: define(‘FTP_USER’, false); define(‘FTP_PASS’, false); Source: http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants

How can I retrieve data within my widget

Read: SELECT_a_Column $sql = “SELECT ‘liters’ FROM ” . $wpdb->prefix . “tfp”; $liters = $wpdb->get_col( $sql ); if( $liters ) { foreach( $liters as $liter ) { echo ‘<option value=”‘ . $liter . ‘”>’ . $liter . ‘</option>’; } }