Hi @hsteigstra,
We’re sorry that you are experiencing problems with your website.
Looking into those given errors, it looks like Yoast is missing a file. If you were to re-install Yoast on the site does the issue resolve? We ask that you please update install again using File Transfer Protocol (FTP). You will need an FTP program such as FileZilla and your FTP details, which can be obtained from your host provider.
If you run into any trouble, let us know and we’ll take another look for you.
Nope…. I already did a reinstall yesterday and also just now a full transfer with FTP. Still the same. Seems as if the files are there, but the registration is not done properly. However, I can read the properties like “title” using YoastSEO()->meta->for_current_page()->title;
Found a work-around: added these requires to add the paths to the source:
require_once ABSPATH . “wp-content/plugins/wordpress-seo/src/presenters/abstract-presenter.php”;
require_once ABSPATH . “wp-content/plugins/wordpress-seo/src/presenters/abstract-indexable-presenter.php”;
Apparently the namespace is not recognised:
namespace Yoast\WP\SEO\Presenters;
Makes that sense ?
Hi @hsteigstra,
Thank you for both of your replies and continued patience.
Looking more closely at the error stack, we see that the error originates from the /genealogie/MyYoast.php file. We are not familiar with this plugin, but we believe they might be running some Yoast integration code which is no longer (fully) compatible with our latest release. While looking up ‘genealogie’ as a plugin, we couldn’t find the exact plugin, so we recommend to reach out to the plugin developers to see if they can fix this issue.
Hope this helps.
Hi Jeroen,
MyYoast is not a plugin but my latest implementation of Abstract_Indexable_Presenter as introduced in 14.0.
This is the (relevant part of the) code:
<?PHP
use Yoast\WP\SEO\Presenters\Abstract_Indexable_Presenter;
require_once ABSPATH . “wp-content/plugins/wordpress-seo/src/presenters/abstract-presenter.php”;
require_once ABSPATH . “wp-content/plugins/wordpress-seo/src/presenters/abstract-indexable-presenter.php”;
class My_Custom_Presenter extends Abstract_Indexable_Presenter {
public function present() {
// do the stuff here….
$meta=”<meta property=’og:image’ content='” . esc_attr($fileName) .
“‘/><meta property=’og:image:width’ content=’$w’/>”.
“<meta property=’og:image:height’ content=’$h’/>”;
return $meta;
}
/**
* Returns the value of our new tag.
*
* @return string The value of our meta tag.
*/
public function get() {
return ( $this->presentation->open_graph_locale === ‘nl_NL’ ) ? ‘Dutch’ : ‘Not dutch’;
}
}
All copied from your example implementation. Without the two lines on top “require_once….” I get the exception, apparently the path to the two php files is not found! In my development site this is not necessary, in my production it is!
May be a clue: in my development site I did not get a runtime error on this syntax in another module:
….. x=y
break;
The semi-colon after the y is forgotten. In my production I did get an error message. Maybe something similar is the case with your software. Language difference? php differences?
Hi, may be I have a clue for this…. On my test site I did not have the “Class not found” problem, but in my production site I did have the problem. I have compared the two sites for differences that may explain this:
* Provider specific… No, same provider.
* PHP specific: No, both 7.3
* Version differences: No, all up-to-date
I have been looking for reasons that could result in not knowing the Class at the time my own code loads. And I found one! The loading order of plugins (my code resides in a plugin) is
* plugins in the mu-plugin folder. (I don’t have any)
* Network defined plugins
* Alphabetically loaded
And now I see the difference: my test site is <b>multi-site!</b> There the Yoast will load before my code. My production is NOT multi-site, so the load is in alphabetical order. Yoast will be one of the last to load!
Not sure if this makes sense, hard to test in my real-life site, but maybe this helps finding a solution!
New version did not solve this problem!
Solved my problem! I installed the plugin “Plugin Organizer” and moved my plugin downwards, just after Yoast SEO. Now it does recognize the class!
I think with this info you can add a php module and add it into the mu-plugins folder to define the classes before anything else is loaded!
Based on the information you provided, we expect this to be a bug. We’re actively using the bug tracking on our GitHub repository so your best next step would be to create a new issue for our developers at https://github.com/Yoast/wordpress-seo/issues/new. You will need an account to create a new issue. If this is your first bug report, please check out: https://kb.yoast.com/kb/how-to-write-a-good-bug-report/.
Hi @hsteigstra ,
Thanks for sharing what fixed your issue. We’re now tagging this thread as resolved. Should you need to report a bug, please utilize our Github repository and feel free to submit a new issue for our developers at https://github.com/Yoast/wordpress-seo/issues/new.