Disabling Author Page only for subscribers

Oddly, perhaps, there is no get_user_role function, so not surprising that the earlier answer produced an error. As per my discussion with Rodney Hawk, I still wonder about the point of this exercise – or what security function this operation serves that wouldn’t be better served by other methods – but, if the preferred objective … Read more

Functions Filter Question [closed]

this is for Variable scope. A variable declared within a function has a LOCAL SCOPE and can only be accessed within that function A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function: $meinungen = Test; // is in global scope function wpseo_set_title_callback($input) { if (is_single()) { … Read more

What is the better for call files: bloginfo() or echo esc_url()?

Note that bloginfo(‘template_url’) is a wrapper for get_template_directory_uri(). It doesn’t seems to explicitly escape it, though. It’s better to escape it in your example. Here are two examples how we can break the HTML in the case it’s not escaped: Break Example #1 add_filter( ‘template_directory_uri’, function( $uri ) { return $uri .'”>’; } ); Break … Read more

Removing “Powered by” footer using child theme PHP [closed]

As the function sparkling_footer_info() uses esc_html__() and this function runs the esc_html filter before outputting, you can intercept the output there. add_filter (‘esc_html’, ‘wpse_245817_esc_html’, 100, 2 ); function wpse_245817_esc_html( $safe_text, $text ) { if ( $safe_text == ‘Theme by %1$s Powered by %2$s’ ) { return ”; } return $safe_text; } Maybe you have to … Read more

Count foreach and display in menu php

You’re incrementing $count but I see you’re referencing $counter. Not sure if those are different but here is a version that uses the same variable in all those places. $counter = 0; //Hier ist der Count-Begin-Foreach foreach ( $bookmarks as $bookmark ) : if ( get_post_status( $bookmark->post_id ) !== ‘publish’ ) { continue; } // … Read more

Change Header (Logo) Based on Login

If WP Members (or another plugin like User Access Manager) provides conditional tags for specifying the current user’s “group” then you could use that to switch out the logo. One of those might also give you a way to insert a class into the <body> tag that you could use to switch out the logo … Read more

How to fetch custom post type by variable date?

First, I assume you store event date in custom field properly. Native WP post published dates are really not meant for future events, since future dates are used for scheduling functionality and make posts non–public. From there it’s just a matter of putting together appropriate get_posts()/WP_Query to retrieve your set. Modern WP version allow very … Read more