Tag Info

Hot answers tagged

3

You can use the logged-in class added by body_class to target your CSS rules. .container { height: 160px } body.logged-in .container { height: 30px }


3

get_currentuserinfo() is a pluggable function, it is not available during plugins load stage. That aside you shouldn't be adding filter conditionally, but use data provided by the filter. If you take a look at filter calls: apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember ) $user_id is provided as second argument. You ...


1

As you may or may not be aware WordPress provides a profile page in the admin for each registered user (including the admin of course!): `http://www.example.com/wp-admin/profile.php' On that page you will see a number of fields that can be edited / customized including a Biographical Info field. To fetch and output a field from this page for a particular ...


1

The problem is that you can't use the value for the LIKE comparison as you've mentioned. The generated SQL will look something along the lines of: AND CAST(wp_usermeta.meta_value AS CHAR) LIKE '%B%' which means that the query is set to look for every occurrence of letter B in our case. Of course this is not what you want, what you would need is something ...


1

The first issue as I see it is that you are using the_terms function. If you actually look in the source code you will see that after a couple of other function calls the whole thing fails because eventually the function get_the_terms is called which checks if the ID you are passing is a valid post. Sometimes this might work though if the user_id might ...


1

First, you should know that current_user_can() only accepts capabilities, not roles, so you are using it wrong and you can end up with unexpected results. That being said, to exlude users form WP_User_Query you can use the exclude parameter: // Get current user data $user = wp_get_current_user(); // Check if current user is a subscriber if( ! empty( $user ...


1

I peeked into the WP_User_Query class and it supports a WP_Date_Query query on the user registration date. So we could use: $query = new WP_User_Query( $args ); or simply: $users = get_users( $args ); where: $args = [ 'fields' => 'ID', 'number' => 8, 'date_query' => [ [ 'before' => '359 days ago midnight' ], ...


1

The best way to do what you are asking is to perform a data EXPORT on the MySQL database using MySQL Workbench from the original instance of WordPress and then IMPORT the relevant tables into the New instance.. Passwords are all encrypted so these would migrate as was.


1

There's two main ways you can do it. Option 1 is to use a tool like PHPMyAdmin to manually export the data to a .sql file and import it into the new database. Option 2 is to use a plugin like https://github.com/wp-sync-db/wp-sync-db to transfer the data. Note that this plugin is an open source fork of a paid plugin. I linked to the open source version ...



Only top voted, non community-wiki answers of a minimum length are eligible