How To Fix TypeError: (0 , o.createPortal) is not a function in WordPress

I like to use Beaver Builder as a page builder. Occasionally you need to edit a page to review Yoast SEO fields or unpublished or set to draft.

I recently did this an encountered an error.

Wordpress edit screen error

When I copied the error and pasted into my IDE I saw the following. 

TypeError: (0 , o.createPortal) is not a function at t.default (https://www.staging3.example.com/wp-content/plugins/wordpress-seo/js/dist/wp-seo-post-scraper-970.min.js?ver=9.7:5:63916) at ph (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88) at eg (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307) at fg (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168) at wc (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237) at fa (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115) at gg (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:135:196) at Ca (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:133:365) at Object.enqueueSetState (https://www.staging3.example.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:191:324) at r.q.setState (https://www.staging3.example.com/wp-includes/js/dist/vendor/react.min.js?ver=16.6.3:20:304)

How To Fix TypeError: (0 , o.createPortal) is not a function

To fix this issue I installed the classic editor and voila, I am now able to edit Yoast SEO fields without error and still use Beaver Builder for my page building activities.

How To Get WordPress Current Category ID and even sub category ID

I was working on a project where I had to get the current WordPress category ID. This meant capturing the WordPress category ID if they were on a parent or child category.

I came up with a variety of ways where it would work in some instances, but not in all scenarios. Here are some details that should be helpful when you want to know the ID of the category the user is currently on.

How to Get WordPress Current Category ID and even sub category ID

Option 1: Get Category ID (Does Not Work with Subcategory)

<?php
if (is_category()){
#$categories = get_the_category();
#$category_id = $categories[0]->cat_ID;
echo $category_id;
}
?>

This will return the Category ID but it did not display the current ID if I was on a subcategory.

Option 2: Get Category ID & Subcategory ID

<?php
if (is_category()){
$category = get_queried_object();
$categorynew = $category->term_id;
echo $categorynew;
}
?>

Thanks to pagecrafter.com I used this because it allowed me to retrieve the category ID for categories and subcategories.

Add a Featured Image to Mailchimp via WordPress RSS Feed

Mailchimp has lots of great features for content creators. One feature I recently used was an RSS feed that passes content for specific categories rom specific categories to Mailchimp AND include the featured image in the RSS feed.

I accomplished this by including the featured image in the RSS feed by updating functions.php. Best practice is to always use a child-theme to add any customizations to functions.php.

I actually like to use the My Custom Functions Plugin to ensure my updates aren’t overwritten or stripped out if that file is ever updated.

Below is the PHP I added to include the WordPress Featured Image in the RSS Feed for Mailchimp.


function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}


add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

If you need help integrating WordPress and Mailchimp – Contact Me

WordCamp US 2016 – Notes and Thoughts

I was fortunate enough to attend WordCamp US in beautiful Philadelphia PA. I set a goal in 2015 to attend the next one – and was proud I followed through – and it was definitely worth it.

Seeing so many other folks passionate about the web, and full of knowledge, tips, and and tricks motivates me to recommit to WordPress and gives me reassurance that it will only get better.

Notes and Takeaways from Wordcamp US 2016

SEO

A good tip to boost SEO ranking is to constantly evaluate some of your older high quality content. Rather than releasing a new post on Shopify Mega Menu’s it would be better if I constantly refine my post about how I built a custom Shopify Mega Menu. That’s a 2017 goal!

Optimize Categories and Tags – Another tip is to optimize the categories and tags of your site. When I think about the categories and tags on my blog – I see the disorganization I’m creating… That’s another 2017 goal! 🙂

Links.Links.Links – You need links, you want links, but never buy links. The takeaway quote was “You will not rank without links”. It doesn’t do much – but I always like to link out to my clients on my work to boost that just a little.

Plan your most important keyword – The action plan I felt was most relevant to me was to think about the most important keyword that drives traffic and conversions to your website – once you have that create a page optimized for THAT keyword – the keyword your customers would use. Then go to Google and search Youdomain:Keyword.

Example Google search on google for my domain and an important keyword

Example Google search on google for my domain and an important keyword