Using wp config to connect to a DB from a plugin

I’m guessing this is a custom “plugin” where you are wanting to run a file externally that connects to the WordPress database, not really as a standard plugin which loads within WordPress environment, as in that case as @belinus says you can just use $wpdb class. Anyway, since ABSPATH is defined IN wp-config.php, you can’t … Read more

How to disable register and reset the password from WordPress admin panel?

put the code bellow into functions.php : class Password_Reset_Removed { function __construct() { add_filter( ‘show_password_fields’, array( $this, ‘disable’ ) ); add_filter( ‘allow_password_reset’, array( $this, ‘disable’ ) ); add_filter( ‘gettext’, array( $this, ‘remove’ ) ); } function disable() { if ( is_admin() ) { $userdata = wp_get_current_user(); $user = new WP_User($userdata->ID); if ( !empty( $user->roles ) … Read more

How do I locate specific file in a post that affects ssl?

A quick squint at your site reveals that you’re serving it with Nginx, so a simple .htaccess redirect won’t work. The following block in your Nginx config should take care of any stray locally-served files that are still coming over http: server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri; } … Read more

How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?

You can use the function xprofile_get_field_data( $field, $user_id, $multi_format) * @param mixed $field The ID of the field, or the $name of the field. * @param int $user_id The ID of the user. * @param string $multi_format How should array data be returned? ‘comma’ if you want a * comma-separated string; ‘array’ if you want … Read more

Remove plugin’s custom post type archive page and single pages [closed]

Actually,this excerpt more with link settings automatically applies from your active theme. In order to fix this problem,Please add the below mentioned filter hook and callback function in your active child theme . function pp_custom_excerpt_length($length) { global $post; // Set content length only of process posts if ($post->post_type == ‘process_posts’ && !is_single()) { //change it … Read more

add query string to all pages after user logged in

add following code to functions.php, add_action(‘wp_head’, ‘your_function’); function your_function(){ if ( is_user_logged_in() ) { $genre_url = add_query_arg(‘aff’, ‘1234567’, get_permalink()); } } Hope this will help you. for more information, is_user_logged_in() How can I include a query string with get_permalink wp_head action hook get_permalink()