Answers.Body: <p>Try adding below lines into civicrm.settings.php file</p>
  <pre><code>global $civicrm_paths;
  $civicrm_paths['civicrm.root']['path'] = '/path-to-wordpress/wp-content/plugins/civicrm/civicrm/';
  $civicrm_paths['civicrm.root']['url'] = 'http://sitename.org/wp-content/plugins/civicrm/civicrm/';
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-14T13:12:24.167Z
Answers.Text: Thank you for your answer.  I think Civi should be calculating these paths so hard-coding them here may not be future proof.  Your answer doesn't explain why the constant isn't replaced with the correct value and that was my question.
Answers.UserDisplayName: axa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-14T11:13:16.707Z
Answers.LastActivityDate: 2020-08-14T11:13:16.707Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>The answer from Pradeep is correct.  The documentation is here: <a href="https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-5.29" rel="nofollow noreferrer">https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-5.29</a></p>
  <p>Version 4.6 used a path and URL convention that is no longer in use.   I would have expected you to be able to go up to version 5.28 (as I have been) but it's possible you have values stored in the settings table.</p>
  <p>I'd add the lines that are detailed above and look to move to the new structure.</p>
  <p>You should also flush all caches, CiviCRM, WP, and flush permalinks.   This will clear out any problems due to pre-compiled templates where CiviCRM references old cached values.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-18T08:09:21.613Z
Answers.Text: Thanks for your answer and for pointing me to the 5.29 doc.  Since I'm trying to upgrade to 5.27 I didn't think the 5.29 warnings would apply yet.  Hopefully this will help others. Its still unclear why this is an issue at 5.27.
Answers.UserDisplayName: axa
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-14T14:15:12.540Z
Answers.LastActivityDate: 2020-08-14T14:15:12.540Z
Answers.UserDisplayName: Kevin Cristiano
Body: <p>first up, many thanks to all who help out in the Civi community.</p>
  <p>I tried upgrading from Civi 4.6.38 to 5.28.0 which failed on the queue runner screen (JS errors).<br />
  <a href="https://i.sstatic.net/HAPUg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HAPUg.png" alt="enter image description here" /></a></p>
  <p>In the screenshot you can see that the path to assets includes the constant CIVICRM_PLUGIN_URL.  This explains the 404 but why hasn't the value of the constant been used?  This matches whats in the Apache error log:</p>
  <p>[Thu Aug 13 15:44:56.862133 2020] [php7:warn] [pid 19200] [client 109.148.55.130:36242] PHP Warning:  Use of undefined constant CIVICRM_PLUGIN_URL - assumed 'CIVICRM_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69, referer: <a href="https://example.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fupgrade&amp;reset=1" rel="nofollow noreferrer">https://example.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fupgrade&amp;reset=1</a>
  [Thu Aug 13 15:44:56.862169 2020] [php7:warn] [pid 19200] [client 109.148.55.130:36242] PHP Warning:  file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290, referer: <a href="https://example.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fupgrade&amp;reset=1" rel="nofollow noreferrer">https://example.com/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fupgrade&amp;reset=1</a></p>
  <p>You can see that file_get_contents() is also using the constant.
  I tailed the civi log file in ConfigAndLog/ but nothing was appended to the log file.</p>
  <p>I've restored and tried a few upgrades to work out where the problem begins; its version 5.27.0.  Version 5.26.2 is as late as I can go, I've also tried 5.27.4 hoping to pick up a fix to no avail.</p>
  <p>I have read version-specific notes and the release notes for 5.2.7:</p>
  <p><a href="https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/" rel="nofollow noreferrer">https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/</a></p>
  <p><a href="https://civicrm.org/blog/dev-team/civicrm-527-release" rel="nofollow noreferrer">https://civicrm.org/blog/dev-team/civicrm-527-release</a></p>
  <p>I have also tried a CLI db upgrade:</p>
  <p>wp civicrm upgrade-db</p>
  <pre><code>    PHP Warning:  Use of undefined constant CIVICRM_PLUGIN_DIR - assumed 'CIVICRM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 68
  Warning: Use of undefined constant CIVICRM_PLUGIN_DIR - assumed 'CIVICRM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 68
  PHP Warning:  Use of undefined constant CIVICRM_PLUGIN_URL - assumed 'CIVICRM_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69
  Warning: Use of undefined constant CIVICRM_PLUGIN_URL - assumed 'CIVICRM_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69
  PHP Warning:  file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  Warning: file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  PHP Warning:  file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  Warning: file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  </code></pre>
  <p>My environment is:
  Wordpress 5.4.2
  Debian Stretch
  PHP 7.3</p>
  <p>In case its helpful files are still in plugins/files/ not the newer location of uploads/</p>
  <p>It appears as if the code in civicrm.php which sets up the defines runs too late but that seems very strange.
  Thanks for reading, I hope this is a well formed question, please let me know if i can improve it.</p>
  
Tags: <wordpress><upgrade>
Title: Cannot upgrade past version 5.26.2, why does constant CIVICRM_PLUGIN_URL appear in URLs and paths?
ThreadText: # Cannot upgrade past version 5.26.2, why does constant CIVICRM_PLUGIN_URL appear in URLs and paths?
  
  (Asked by: username_0 on 2020-08-14)
  
  first up, many thanks to all who help out in the Civi community.
  
  I tried upgrading from Civi 4.6.38 to 5.28.0 which failed on the queue runner screen (JS errors).  
  [![enter image description here](https://i.sstatic.net/HAPUg.png)](https://i.sstatic.net/HAPUg.png)
  
  In the screenshot you can see that the path to assets includes the constant CIVICRM\_PLUGIN\_URL. This explains the 404 but why hasn't the value of the constant been used? This matches whats in the Apache error log:
  
  [Thu Aug 13 15:44:56.862133 2020] [php7:warn] [pid 19200] [client 109.148.55.130:36242] PHP Warning: Use of undefined constant CIVICRM\_PLUGIN\_URL - assumed 'CIVICRM\_PLUGIN\_URL' (this will throw an Error in a future version of PHP) in /home/user\_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69, referer: <https://example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fupgrade&reset=1>
  [Thu Aug 13 15:44:56.862169 2020] [php7:warn] [pid 19200] [client 109.148.55.130:36242] PHP Warning: file\_get\_contents(CIVICRM\_PLUGIN\_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user\_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290, referer: <https://example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fupgrade&reset=1>
  
  You can see that file\_get\_contents() is also using the constant.
  I tailed the civi log file in ConfigAndLog/ but nothing was appended to the log file.
  
  I've restored and tried a few upgrades to work out where the problem begins; its version 5.27.0. Version 5.26.2 is as late as I can go, I've also tried 5.27.4 hoping to pick up a fix to no avail.
  
  I have read version-specific notes and the release notes for 5.2.7:
  
  <https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/>
  
  <https://civicrm.org/blog/dev-team/civicrm-527-release>
  
  I have also tried a CLI db upgrade:
  
  wp civicrm upgrade-db
  
  ```
      PHP Warning:  Use of undefined constant CIVICRM_PLUGIN_DIR - assumed 'CIVICRM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 68
  Warning: Use of undefined constant CIVICRM_PLUGIN_DIR - assumed 'CIVICRM_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 68
  PHP Warning:  Use of undefined constant CIVICRM_PLUGIN_URL - assumed 'CIVICRM_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69
  Warning: Use of undefined constant CIVICRM_PLUGIN_URL - assumed 'CIVICRM_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php on line 69
  PHP Warning:  file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  Warning: file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  PHP Warning:  file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  Warning: file_get_contents(CIVICRM_PLUGIN_DIRcivicrm/extension-compatibility.json): failed to open stream: No such file or directory in /home/user_dev/example.com/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Extension/System.php on line 290
  
  ```
  
  My environment is:
  Wordpress 5.4.2
  Debian Stretch
  PHP 7.3
  
  In case its helpful files are still in plugins/files/ not the newer location of uploads/
  
  It appears as if the code in civicrm.php which sets up the defines runs too late but that seems very strange.
  Thanks for reading, I hope this is a well formed question, please let me know if i can improve it.
  
  **Tags:** wordpress, upgrade
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-08-14. Score: 2
  
  Try adding below lines into civicrm.settings.php file
  
  ```
  global $civicrm_paths;
  $civicrm_paths['civicrm.root']['path'] = '/path-to-wordpress/wp-content/plugins/civicrm/civicrm/';
  $civicrm_paths['civicrm.root']['url'] = 'http://sitename.org/wp-content/plugins/civicrm/civicrm/';
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you for your answer.  I think Civi should be calculating these paths so hard-coding them here may not be future proof.  Your answer doesn't explain why the constant isn't replaced with the correct value and that was my question.  
  
  ---
  
  ### Answer by username_2 on 2020-08-14. Score: 0
  
  The answer from username_1 is correct. The documentation is here: <https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-5.29>
  
  Version 4.6 used a path and URL convention that is no longer in use. I would have expected you to be able to go up to version 5.28 (as I have been) but it's possible you have values stored in the settings table.
  
  I'd add the lines that are detailed above and look to move to the new structure.
  
  You should also flush all caches, CiviCRM, WP, and flush permalinks. This will clear out any problems due to pre-compiled templates where CiviCRM references old cached values.
  
  > **Comments:**
  > **username_0**: Thanks for your answer and for pointing me to the 5.29 doc.  Since I'm trying to upgrade to 5.27 I didn't think the 5.29 warnings would apply yet.  Hopefully this will help others. Its still unclear why this is an issue at 5.27.  
  
  ---
  
  