WordPress wp_oembed_get error - php

I'm having issues with a video shortcode in wordpress and decided to create a php script to test the wp_oembed_get function and make sure that everything was working fine, but when I call:
$embed_code = wp_oembed_get('http://vimeo.com/XXXX', array('width'=>400));
I'm getting this:
Fatal error: Call to a member function get() on a non-object in /var/www/html/xxxxx/wp-includes/cache.php on line 113
Any ideas?

Related

Fatal Error after moving site from one host to another

I have recently moved a website from one host to another and all went smoothly except one plugin wont reactivate due to the following error:
Fatal error: Cannot redeclare NDScoutsGallery::update() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/ndscouts.php on line 115
This is the line of code it is referring to:
function update($new_instance, $old_instance) {
I have attempted to sort however was unsuccessful. Any assistance would be appreciated.
The update function is already created in word press, You can rename the function Name in NDScoutsGallery and call using updated function. It will work

TWIG/Timber dump function leads to "fatal error"

I'm trying to use the dump function as was advides by a bunch of people, so I could get a better hang of Timber/TWIG.
However when I try it i get the following error:
Fatal error: Uncaught Twig_Error_Syntax: Unknown "dump" function.
I am confused, since this should be included in Timber itsself.
Another thing is that ACF (Wordpress) functions don't seem to work.
Just enable the WP debug in wp-config.
define('WP_DEBUG', true);

Can't figure out what is causing this Fatal error: Call to a member function format() on a non-object in

The php file that I have has been starting to act up lately. It has been working for years up until just a month ago. I have looked everywhere and can not find anything that will fix this issue.
In the screenshot its the line that is circled that is throwing the error of
Fatal Error: Call to a member function format() on non-object in .....php.
So if I change it
$recent_hire_date = date_format($employee['STRTDATE'],'Ymd');
I then later have to move down further in the PHP file and update each one that is like the one in circled line. However, when I run this php file (it generates a file), When looking at the data in the file it actually only shows 0 it does not show the correct data.

Magento getConfigurableAttributesAsArray causes fatal error

I am trying to write a script that creates configurable products. Ive been using this as a guide: http://inchoo.net/magento/programmatically-create-a-configurable-magento-product/
When I get to this line:
$configurableAttributesData = $configProduct->getTypeInstance()->getConfigurableAttributesAsArray();
The script crashes and kicks out this error:
Fatal error: Call to a member function getId() on a non-object in /home/buyfrom/public_html/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 283
Following a comment on this page, I changed that line to the following:
$possibleAttributes = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
But I am still getting this error. Can anyone suggest how to fix this?
Make sure that attribute set (eg. default) which you are choosing is having at least one configurable attribute (example: 'color' or 'size').

Fatal Error: Call to member function xpath to non-object AFTER uploading to provider

I'm trying to extract data from a tumblr XML-Feed and it works perfectly on my local MAMP-Server. However, having uploaded it to my provider's server I get the following error:
Fatal error: Call to a member function xpath() on a non-object in
/home/httpd/vhosts/anthronaut.net/subdomains/nico/httpdocs/scripts/tumblr.php
on line 19
Here's the part of the code in question:
$request_url = "http://nicolasblandin.tumblr.com/api/read";
$xml = simplexml_load_file($request_url);
$posts = $xml->xpath("/tumblr/posts/post");
My hunch is that the serverside settings need to be changed. I found one setting allow_url_fopenand set it to true, however with no success.
Any ideas would be greatly appreciated! Thanks
The problem seems to be that simplexml_load_file returns an array of type SimpleXMLElement. So, changing the third line of your code to
$posts = $xml[0]->xpath("/tumblr/posts/post");
seems to solve the issue. The real question is now: why does it actually work in the other case?

Categories