diff --git a/README.md b/README.md
index 1bb1ee2e..01a140d7 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@
**Donate link:** https://www.paypal.me/BrainstormForce
**Requires at least:** 4.4
**Requires PHP:** 5.4
-**Tested up to:** 5.0
-**Stable tag:** 1.1.3
+**Tested up to:** 5.2
+**Stable tag:** 1.1.4
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
@@ -115,6 +115,9 @@ If the above is nnot possible, You can also add support for the plugin from your
## Changelog ##
+### 1.1.4 ###
+- Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer.
+
### 1.1.3 ###
- Improvement: Allow changing the permalinks for the hfe templates (#162)
- Fix: WPML Translations do not work when using the Elementor Template as a shortcode. (#159)
diff --git a/header-footer-elementor.php b/header-footer-elementor.php
index 132853a4..2e1e5f27 100644
--- a/header-footer-elementor.php
+++ b/header-footer-elementor.php
@@ -7,12 +7,12 @@
* Author URI: https://www.brainstormforce.com/
* Text Domain: header-footer-elementor
* Domain Path: /languages
- * Version: 1.1.3
+ * Version: 1.1.4
*
* @package header-footer-elementor
*/
-define( 'HFE_VER', '1.1.3' );
+define( 'HFE_VER', '1.1.4' );
define( 'HFE_DIR', plugin_dir_path( __FILE__ ) );
define( 'HFE_URL', plugins_url( '/', __FILE__ ) );
define( 'HFE_PATH', plugin_basename( __FILE__ ) );
diff --git a/inc/class-header-footer-elementor.php b/inc/class-header-footer-elementor.php
index 868b8b0e..5098be6b 100644
--- a/inc/class-header-footer-elementor.php
+++ b/inc/class-header-footer-elementor.php
@@ -120,6 +120,9 @@ public function includes() {
// Load the Admin Notice Class.
require_once HFE_DIR . 'inc/class-hfe-notices.php';
+
+ // Setup upgrade routines.
+ require_once HFE_DIR . 'inc/class-hfe-update.php';
}
/**
diff --git a/inc/class-hfe-update.php b/inc/class-hfe-update.php
new file mode 100644
index 00000000..1c84f2b0
--- /dev/null
+++ b/inc/class-hfe-update.php
@@ -0,0 +1,97 @@
+
+ * @copyright Copyright (c) 2019, Header Footer Elementor
+ * @link https://github.com/Nikschavan/header-footer-elementor/
+ * @since HFE 1.1.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+if ( ! class_exists( 'HFE_Update' ) ) {
+
+ /**
+ * HFE_Update initial setup
+ *
+ * @since 1.1.4
+ */
+ class HFE_Update {
+
+ /**
+ * Option key for stored version number.
+ *
+ * @since 1.1.4
+ * @var string
+ */
+ private $db_option_key = '_hfe_db_version';
+
+ /**
+ * Constructor
+ *
+ * @since 1.1.4
+ */
+ public function __construct() {
+
+ // Theme Updates.
+ if ( is_admin() ) {
+ add_action( 'admin_init', array( $this, 'init' ), 5 );
+ } else {
+ add_action( 'wp', array( $this, 'init' ), 5 );
+ }
+ }
+
+ /**
+ * Implement theme update logic.
+ *
+ * @since 1.1.4
+ */
+ public function init() {
+ do_action( 'hfe_update_before' );
+
+ if ( ! $this->needs_db_update() ) {
+ return;
+ }
+
+ // flush rewrite rules on plugin update.
+ flush_rewrite_rules();
+
+ $this->update_db_version();
+
+ do_action( 'hfe_update_after' );
+ }
+
+ /**
+ * Check if db upgrade is required.
+ *
+ * @since 1.1.4
+ * @return true|false True if stored database version is lower than constant; false if otherwise.
+ */
+ private function needs_db_update() {
+ $db_version = get_option( $this->db_option_key, false );
+
+ if ( false === $db_version || version_compare( $db_version, HFE_VER ) ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Update DB version.
+ *
+ * @since 1.1.4
+ * @return void
+ */
+ private function update_db_version() {
+ update_option( $this->db_option_key, HFE_VER );
+ }
+
+ }
+}
+
+new HFE_Update();
diff --git a/package.json b/package.json
index 0e29910e..0d20d9cd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "header-footer-elementor",
- "version": "1.1.3",
+ "version": "1.1.4",
"main": "Gruntfile.js",
"author": "Nikhil Chavan",
"devDependencies": {
diff --git a/readme.txt b/readme.txt
index d5806ad5..7aff3da8 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,8 +4,8 @@ Tags: elementor, header footer builder, header, footer, page builder, template b
Donate link: https://www.paypal.me/BrainstormForce
Requires at least: 4.4
Requires PHP: 5.4
-Tested up to: 5.0
-Stable tag: 1.1.3
+Tested up to: 5.2
+Stable tag: 1.1.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -115,6 +115,9 @@ If the above is nnot possible, You can also add support for the plugin from your
== Changelog ==
+= 1.1.4 =
+- Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer.
+
= 1.1.3 =
- Improvement: Allow changing the permalinks for the hfe templates (#162)
- Fix: WPML Translations do not work when using the Elementor Template as a shortcode. (#159)