is_admin() does not work when accessing via Android app

  1. I run a multilingual web site using a multisite installation.

    To overcome the problem, that the different languages should all have the same title BUT I still want to be able to distinguish between the sites in the backend, I added the following code:

    function my_blogname() {
        return 'My Blog';
    if(!is_admin()) add_filter( 'pre_option_blogname', 'my_blogname' );

    So far this works fine in the browser - the visitors will always see the blog name "My Blog" in the frontend and I can still distinguish the language specific blogs in the backend by giving them names like "My blog - English", "My Blog - German" and so on.

    However - when using the Android app it seems that is_admin() returns false and therefore all blogs get the same title in the Android app and the only obvious hint is the language used in the posts.

    Well - of course I could override the title by manually adding the text to the template instead of using get_bloginfo() or bloginfo(). But this would really be a crude hack which I want to avoid.

    Any chance that the app can get the "real" blog name from the backend?

    Or if this is not possible: Make blog names editable - so I can set the name locally in the Android app. This would make the handling of multilingual blogs based on multisite setups much easier.

  2. Try with something like this:

    function my_blogname() {
    	if ( ( defined( 'XMLRPC_REQUEST') && XMLRPC_REQUEST ) ) {
    		return 'Title for the app';
    	if ( is_admin() ) {
    		return '2nd title';
    	return false;
    add_filter( 'pre_option_blogname', 'my_blogname' );

    or hook the 'option_blogname' if you need to know the default value.

    Note that blogname is set when the blog is added within the app. If you change the blogname later in the dashboard, it will not be updated in the Android app. I've filled a ticket for this:

  3. @daniloercoli Thanks for the hint. I came up with another solution, since the filter must ONLY be set, when neither the admin panel is shown nor a call is made using XMPRPC:

    function my_blogname() {
        return 'My Blogname';
    if ( !is_admin() && !(defined( 'XMLRPC_REQUEST') && XMLRPC_REQUEST) ) {
    	add_filter( 'pre_option_blogname', 'my_blogname' );

    This works fine for the Android app as well - now I can easily distinguish the different blogs of my multisite setup and still keep a "global" blog name for all site.

Topic Closed

This topic has been closed to new replies.

About this Topic