<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Can&#039;t use the function WPF()-&gt;post-&gt;add($reply) - Bug Reports				            </title>
            <link>https://wpforo.com/community/general-forums-bug-reports/cant-use-the-function-wpf-post-addreply/</link>
            <description>Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 12 Mar 2026 10:42:52 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Can&#039;t use the function WPF()-&gt;post-&gt;add($reply)</title>
                        <link>https://wpforo.com/community/general-forums-bug-reports/cant-use-the-function-wpf-post-addreply/#post-108469</link>
                        <pubDate>Fri, 09 Feb 2024 11:17:07 +0000</pubDate>
                        <description><![CDATA[You can&#039;t access it from the single .php file. You&#039;ll need to create a separate plugin. Utilize the wpforo_core_inited hook and then add your custom logic.]]></description>
                        <content:encoded><![CDATA[<p>You can't access it from the single .php file. You'll need to create a separate plugin. Utilize the wpforo_core_inited hook and then add your custom logic.</p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/general-forums-bug-reports/">Bug Reports</category>                        <dc:creator>Sofy</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/general-forums-bug-reports/cant-use-the-function-wpf-post-addreply/#post-108469</guid>
                    </item>
				                    <item>
                        <title>Can&#039;t use the function WPF()-&gt;post-&gt;add($reply)</title>
                        <link>https://wpforo.com/community/general-forums-bug-reports/cant-use-the-function-wpf-post-addreply/#post-108451</link>
                        <pubDate>Thu, 08 Feb 2024 12:08:52 +0000</pubDate>
                        <description><![CDATA[I having some troubles with WPF() function.I want to migrate old forum with a old data base, I need to insert reply in specific topic for all data i need to migrate. i parse my data and as i...]]></description>
                        <content:encoded><![CDATA[<p>I having some troubles with WPF() function.<br /><br />I want to migrate old forum with a old data base, I need to insert reply in specific topic for all data i need to migrate. i parse my data and as it was mentionnened on this post : <br /><a title="is-there-any-way-to-add-new-posts-to-the-forum-programatically" href="https://wpforo.com/community/how-to-and-troubleshooting-2/is-there-any-way-to-add-new-posts-to-the-forum-programatically/" target="_blank" rel="noopener">https://wpforo.com/community/how-to-and-troubleshooting-2/is-there-any-way-to-add-new-posts-to-the-forum-programatically/</a><br /><br />i try to use this after require_once:</p>
<pre contenteditable="false">require_once(__DIR__.'/wp-load.php');


if(function_exists('WPF')) {
        $reply = array(
                'userid'  =&gt; 3,
                'title'   =&gt; 'RE',
                'body'    =&gt; 'test 2',
                'topicid' =&gt; 39,
                'created' =&gt; new \DateTime()
                );
    $wpf = WPF()-&gt;post-&gt;add($reply);
    exit;
}</pre>
<p>i have this result when i launch my script : <br /><br />Error: Call to a member function add() on null<br /><br />WPF exist cause i test if function exist but the property post is null.<br /><br />I think this method (init_classes) in wpforo.php has not been call in this script, i try to call it in constructor but there is somes trouble after : <br /><br /></p>
<pre contenteditable="false">private function init_classes() {
		do_action( 'wpforo_before_init_classes' );
		$this-&gt;activity = new Activity();
		$this-&gt;api      = new API();
		$this-&gt;feed     = new Feed();
		$this-&gt;form     = new Forms();
		$this-&gt;forum    = new Forums();
		$this-&gt;log      = new Logs();
		$this-&gt;postmeta = new PostMeta();
		$this-&gt;post     = new Posts();
		$this-&gt;seo      = new SEO();
		$this-&gt;topic    = new Topics();
		$this-&gt;reaction = new Reactions();
		$this-&gt;bookmark = new Bookmarks();
		$this-&gt;sbscrb   = new Subscriptions();
		if( wpforo_is_module_enabled( 'revisions' ) ) $this-&gt;revision = new Revisions();

		do_action( 'wpforo_after_init_classes' );
	}</pre>
<p><br /><br /><br />Any idea about my issue ? <br /><br />Thanks</p>]]></content:encoded>
						                            <category domain="https://wpforo.com/community/general-forums-bug-reports/">Bug Reports</category>                        <dc:creator>maxdev</dc:creator>
                        <guid isPermaLink="true">https://wpforo.com/community/general-forums-bug-reports/cant-use-the-function-wpf-post-addreply/#post-108451</guid>
                    </item>
							        </channel>
        </rss>
		