Drupal 8.5 admin/content页面"ADD CONTENT"按钮消失求助
Hey there, let's dig into why that "ADD CONTENT" button vanished from your /admin/content page in Drupal 8.5 with the Seven theme. Here are the most likely fixes to work through step by step:
1. Double-Check User Permissions
This is the most common culprit—your user role might have lost the necessary permissions to create content.
- Head over to
/admin/people/permissionsin your Drupal backend. - Find the role assigned to your account (e.g., Administrator, Editor). Make sure you’ve checked:
- Access content overview (under the System permissions group)
- All relevant permissions under the Create content group (e.g., "Create page content", "Create article content")
- Save the permissions, then refresh the
/admin/contentpage to see if the button comes back.
2. Verify Seven Theme Customizations
If you’ve modified the Seven theme (or created a subtheme), you might have accidentally removed the button’s code:
- If you’re using a Seven subtheme, temporarily switch back to the core Seven theme to test if the button reappears. If it does, the issue is in your subtheme’s templates or hooks.
- Check for a custom template file like
page--admin--content.html.twigin your theme’s templates folder. Compare it to the core Seven theme’s version of the file—you might have deleted the section that renders the "ADD CONTENT" button. - Look for custom hooks in your theme’s
.modulefile (if any) likehook_preprocess_pageorhook_page_attachments_alterthat could be removing the button from the page.
3. Rule Out Module Conflicts or Glitches
Modules that modify admin interfaces or content permissions can sometimes break this button:
- Disable any modules you’ve recently installed or updated (especially ones like Content Access, Admin Toolbar, or custom modules that tweak content management). Refresh the page after each disable to see if the button returns.
- Clear all Drupal caches by going to
/admin/config/development/performanceand clicking "Clear all caches". Stale cache often causes UI elements to go missing. - Check your Content Views configuration: Go to
/admin/structure/views/view/content, edit the view. Look in the Header section—if the "Add content" button block was removed, re-add it. Also, ensure the view’s settings haven’t disabled the ability to add content.
4. Check for Core File Corruption or Database Errors
If none of the above works, let’s rule out deeper issues:
- Re-upload the Drupal 8.5 core files (make sure not to overwrite your
sites/directory, which contains your config, themes, and modules). This fixes any corrupted core files that might be causing the button to not render. - Check the Drupal error log at
/admin/reports/dblogfor recent errors related to the/admin/contentpage. Look for messages about permission denied, template rendering failures, or missing hooks—these can point you to the root cause.
Bonus: Inspect the Page with Browser Dev Tools
Sometimes the button is actually there but hidden by custom CSS. Right-click on the area where the button should be, select "Inspect", and check if the button element exists but has display: none or visibility: hidden applied. If so, track down the CSS rule hiding it and adjust it.
内容的提问来源于stack exchange,提问作者user3196800

