How can I configure block visibility to show only in node view pages? (not in node edit and create pages)

What should I insert in "Show block on specific pages" > "Only the listed pages"? current config is:


Use this in your block configurations page "Show block on specific pages" > "Show if the following PHP code returns TRUE"

if(arg(0) == 'node' && is_numeric(arg(1)) && ((arg(2) == "" || arg(2) == 'view'))) {
  return TRUE;

Hope this will help.

You will need to enable the core module PHP.


I use the Context Module for this. It allows a more fine grained control than the out-of-the-box drupal-options.

  • +1 Context is definitely the best suited for this type of thing. Only thing with Context at the moment is it can't handle "Block Configurations" per context, you need to configure the block from the block admin screen.
    – Beebee
    Jun 29 '12 at 12:21

Use contenttypes instead of pages. Then select all contentypes.

  • and what about video page? which is a list of videos created in views Jun 20 '12 at 10:16
  • Make a block of the view and display it on a page?
    – Puyol
    Jun 20 '12 at 10:38

Select the block you wish to exclude and add '/edit' and '/add/*' to the 'Pages' tab in the 'Visibility settings'. You can use 'Content types' in combination with these settings to fine tune a bit further. edit/add

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.